Skip to content

Commit

Permalink
Create overarching Cargo workspace
Browse files Browse the repository at this point in the history
This makes it easier for engineers unfamiliar with the project to see
where all the crates live and prevents lots of nested target/ and
Cargo.lock files from cluttering up the tree.

It's perhaps not as useful as for other projects, since optee-utee still
needs to be built via Xargo, which means "cargo build" from the root
can't build everything. But the other benefits still apply.

I had to rename the "systest" crates inside optee-teec and optee-utee so
their names don't conflict. I also didn't include examples in the
workspace yet, since every example currently has the same three crate
names, meaning multiple can't coexist in one workspace. Also, the
example Makefiles and tests/ scripts hardcode per-example target/ dirs.

If we did add the examples to the workspace, we could build all of them
much faster since they'd share a dependency graph. Doing that is just
out of scope of this commit.
  • Loading branch information
tchebb committed Apr 21, 2023
1 parent 56210a5 commit 0bb8b9c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
# specific language governing permissions and limitations
# under the License.

/optee-utee/Cargo.lock
/optee-teec/Cargo.lock
/Cargo.lock
/examples/**/proto/Cargo.lock
*.rs.bk
.user_ta_header.o.d
Expand Down
44 changes: 44 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[workspace]
# The -sys and macros crates would included in the workspace transitively even
# if not listed, but list them anyway for completeness.
members = [
"optee-teec",
"optee-teec/macros",
"optee-teec/optee-teec-sys",
"optee-teec/systest",
"optee-utee",
"optee-utee/macros",
"optee-utee/optee-utee-sys",
"optee-utee/systest",
]

# Don't try to build crates requiring Xargo on a workspace-level "cargo build",
# since they'll just fail.
default-members = [
"optee-teec",
"optee-teec/systest",
]

exclude = [
# OP-TEE contains no Rust code, but exclude it in case future versions do.
"optee",
"rust",
"examples",
]
3 changes: 0 additions & 3 deletions optee-teec/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ optee-teec-macros = { path = "macros" }
libc = "0.2"
uuid = "0.7"
hex = "0.3"

[workspace]
members = ['systest']
2 changes: 1 addition & 1 deletion optee-teec/systest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

[package]
name = "systest"
name = "optee-teec-systest"
version = "0.2.0"
authors = ["Teaclave Contributors <[email protected]>"]
license = "Apache-2.0"
Expand Down
3 changes: 0 additions & 3 deletions optee-utee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,3 @@ libc = { path = "../rust/libc", version = "=0.2.99" }
bitflags = "=1.0.4"
uuid = { version = "0.8", default-features = false }
hex = "0.3"

[workspace]
members = ['systest']
2 changes: 1 addition & 1 deletion optee-utee/systest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

[package]
name = "systest"
name = "optee-utee-systest"
version = "0.2.0"
authors = ["Teaclave Contributors <[email protected]>"]
license = "Apache-2.0"
Expand Down

0 comments on commit 0bb8b9c

Please sign in to comment.