Skip to content

examples: reorganize crates into TA and CA workspaces#309

Merged
ivila merged 1 commit into
apache:mainfrom
ivila:reorganize_files
Jul 13, 2026
Merged

examples: reorganize crates into TA and CA workspaces#309
ivila merged 1 commit into
apache:mainfrom
ivila:reorganize_files

Conversation

@ivila

@ivila ivila commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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:

  • Overall CI time decreased from 24 minutes to 10 minutes
  • CA build artifacts use 736 MB
  • TA build artifacts use 1.6 GB
  • Build artifacts are reused throughout CI and cleaned after the complete build

More idiomatic Rust project structure

The new layout follows standard Rust workspace conventions:

  • CA and TA crates are managed by separate workspaces
  • Protocol definitions are organized as modules in one shared proto crate
  • Common build logic is centralized in workspace-specific Makefile includes
  • Workspace-level dependency resolution and lock files reduce duplicated configuration

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:

  • UUIDs and commands have a single source of truth
  • Inter-TA callers and callees cannot silently drift apart
  • Adding or changing commands is safer and easier to maintain
  • Multi-TA dependencies are explicit in Rust code

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.

* 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.
@DemesneGH

Copy link
Copy Markdown
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!

@ivila

ivila commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

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!

I’ll verify tomorrow and open a PR if it does (which I think it should).

@ivila
ivila merged commit 015c0f9 into apache:main Jul 13, 2026
18 checks passed
@ivila ivila added the ci label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants