examples: reorganize crates into TA and CA workspaces#309
Merged
Conversation
* Split the examples into dedicated TA and CA Cargo workspaces and consolidate the protocol definitions into a single proto crate. * Centralize the workspace build rules, relocate plugin assets, and update tests, documentation, license exclusions, and cargo-optee paths for the new layout. * Reuse workspace build artifacts across cargo-optee CI builds, report their disk usage, and clean them after the complete build.
Contributor
|
LGTM! BTW does this PR also help reduce building artifacts in OP-TEE repo? If so, could you help to pin the latest version in OP-TEE manifest after this PR merged? Thanks! |
Contributor
Author
I’ll verify tomorrow and open a PR if it does (which I think it should). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR reorganizes the examples into dedicated CA and TA Cargo workspaces and consolidates shared protocol definitions into a single proto crate.
Benefits
Faster and more resource-efficient CI
The workspace layout allows examples to reuse compiled dependencies instead of rebuilding them for each individual example.
As a result:
More idiomatic Rust project structure
The new layout follows standard Rust workspace conventions:
This is especially useful for examples containing multiple TAs. Each TA can be represented as an independent workspace member while sharing dependencies, protocol types, build
configuration, and artifacts naturally through Cargo.
Better inter-TA communication
The consolidated proto crate also improves inter-TA calls. A TA can directly import another TA’s UUID and command definitions from the corresponding protocol module.
This removes the need to hard-code another TA’s UUID or duplicate its command IDs in the caller. Consequently:
For example:
use proto::hello_world::{Command, UUID};
New Layout
examples/
├── ca/
│ ├── Cargo.toml
│ ├── Makefile.include
│ └──
└── ta/
├── Cargo.toml
├── Makefile.include
├── proto/
└──
The resulting organization is faster to build, easier to maintain, safer for inter-TA communication, and better aligned with Rust conventions.