Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a Rust workspace for consolidating build dependencies #196

Closed
wants to merge 1 commit into from

Conversation

geky
Copy link
Member

@geky geky commented Aug 13, 2021

This is a bit of exploratory work to try sharing build-time dependencies by a common Rust workspace.

Note that this workspace only includes the high-level (platform-agnostic?) Veracruz libraries. This specifically excludes:

  • rust-examples/*, which compile to WebAssembly

  • runtime-manager, root-enclaves, sdks which have special requirements

This has also only been tested for SGX, but since most of the platform-specific configuration remains in the Makefile, it should just work for other platforms.

This was a surprisingly unintrusive change, though required a few tweaks:

  • Fixed dependencies that disagreed, this is probably a good thing anyways

  • Consolidated build profiles. There are package-specific build-profiles, but the only customization we had was for profile.release, and I suspect the crates that didn't customize profile.release were just never compiled outside of debug mode.

  • Consolidated patches. This is probably a good thing as I suspect that the patches were required for all dependent crates, and this will reduce mistakes when adding new crates in the future.

Some other thoughts:

  • We've discussed breaking the workspaces out into per-platform workspaces + symlinks. This doesn't seem like a strict requirement, since you can still build each package with its own feature/profile/etc flags. But it may be nice for organizational reasons, and to avoid future risks with conflicting dependencies/patches between platforms.

    Though this may be something that gets cleaned up nicely by Isolate platform specific changes to their own crates #81. If each platform is its own crate/workspace, inside the high-level, common Veracruz crates/workspace, then we would get the separation of per-platform configuration without need to use symlinks. It would result in some build-dependency duplication, but only worst case 2x vs Nx.

  • You may think you can use the documented package shorthand in the root cargo build --package veracruz-test --features sgx, but you can't. At least now with the --features flag. You can, however, provide --features to builds in the directory or with --manifest-path cargo build --manifest-path veracruz-test/Cargo.toml --features sgx, which does use the workspace as any local builds search upwards for a workspace Cargo.toml. Not sure why this limitation exists.

    building workspaces can't use --features flag rust-lang/cargo#5015

    If you went the per-platform workspace direction, you could specify these feature flags as "default-features" in the workspace.

  • I also just wanted to clarify that both the relative path dependencies and non-root builds do work with workspaces and do use the common target directory. Which is why this required so few changes.

  • I also considered moving the rust-examples into a WebAssembly-specific workspace, but didn't as I'm not sure there's that much of an advantage there. The examples don't have that many dependencies, are each intended to be standalone (different build profiles?), and adopting a slightly more complex workspace system in the examples risks confusing users who just copy-paste an example to get started.

  • The workspace does include some non-root crates: freestanding-execution-engine, wasm-checker, generate-policy. These did have some dependencies on the rest of Veracruz, so I wonder if the sdk/test-collateral directories are the wrong place for them and they should be moved into root.

  • The data-generators are included in the workspace, I don't really have any thoughts on these.

@veracruz-project-owner
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: Veracruz
  • Commit ID: a3da971
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@geky
Copy link
Member Author

geky commented Aug 13, 2021

Oh, I also didn't touch the Makefile, but in theory the multi-project rules (make clean, make update, make fmt), can be simplified now

Note that this workspace only includes the high-level
(platform-agnostic?) Veracruz libraries. This specifically excludes:

- rust-examples/*, which compile to WebAssembly

- runtime-manager/root-enclaves, sdks which have special requirements

This was a surprisingly unintrusive change, though required a few
tweaks:

- Fixed dependencies that disagreed, this is probably a good thing
  anyways

- Consolidated build profiles. There are package-specific
  build-profiles, but the only customization we had was for
  profile.release, and I suspect the crates that didn't customize
  profile.release were just never compiled outside of debug mode.

- Consolidated patches. This is probably a good thing as I suspect that
  the patches were required for all dependent crates, and this will
  reduce mistakes when adding new crates in the future.
@veracruz-project-owner
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: Veracruz
  • Commit ID: 74131ff
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@dominic-mulligan-arm dominic-mulligan-arm added always-refactoring A refactoring/code quality change to the Veracruz codebase build-process Something related to the Veracruz build process enhancement New feature or request labels Aug 16, 2021
@dominic-mulligan-arm
Copy link
Member

@geky can this be closed given @mathias-arm's work?

@geky
Copy link
Member Author

geky commented Nov 16, 2021

Yep, closing for now. The code/branch is still available in case it's useful

@geky geky closed this Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
always-refactoring A refactoring/code quality change to the Veracruz codebase build-process Something related to the Veracruz build process enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants