-
Notifications
You must be signed in to change notification settings - Fork 39
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
Remove platform-specific conditional dependencies #111
Remove platform-specific conditional dependencies #111
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me 👍
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
I don't think there's a reason to not merge this, but have you considered instead making these use After #81, they may end up not even needing to be conditional. |
I was under the impression that does not work in Cargo, see e.g. 1. I'll experiment, though, and use that approach if I can indeed get it to work. |
b5e625c
to
56d95a9
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@geky, selecting target dependencies based on a feature definitely does not work in Cargo. Trying it, you get an explicit warning:
Moreover, I think this change is going to be much more involved than I first appreciated. The To properly fix this, we need to follow the approach used in the SDK at the moment, and introduce an OPTEE and SGX-specific target triple, to allow us to distinguish between the different targets (actually, both the Rust OPTEE and SGX SDKs already provide their own triple JSON specification files for this purpose). Unfortunately, I think that this means we will need to use Xargo, instead of Cargo, for compiling the project! |
Thinking more, an alternative would be to drop target-based conditional dependencies altogether, and just use features to select dependencies. Given #81 I think this would actually be the neatest: all platform-specific dependencies are imported by platform-specific crates, which are then selected by other platform-neutral crates using features (in hindsight, this may be what @geky was talking about, above, which I missed). |
Does anyone remember why we (mostly I...) didn't use xargo to begin with for the TA code? |
Well... having used Xargo in the SDK it's quite fickle, no longer maintained, and very poorly documented. I think not using it, if it wasn't needed at the time, was a pretty defensible decision to make. I think at one point about a year ago I tried adopting Xargo as our main build tool and gave up. I may be more successful this time in using it, with the experience from deploying it in the SDK, but I think we made the right decision in avoiding it early in the project. |
All those packages actually are already guarded by features. I marked many packages as optional and will only been imported when certain features are selected. It will be double assurance by also using (legacy) target-based conditions. However, I do not mind to drop target-based conditions all together. For @dreemkiller question: when I updated sgx-sdk, I have spent some time on swaping all to xargo. I vaguely remember the interactions between xargo importing tz backend and xargo importing sgx backend causes some problems and then I gave up at some point. |
Does anybody know why some dependencies are guarded by target-dependent conditional clauses in Cargo.toml files, then? |
That's likely legacy cruft. We initially did not use features, instead relying on |
OK, that's what I was hoping. Then the best way forward seems to be clear: get rid of the target-conditional dependencies and use (optional) features for everything, instead. No need for Xargo, and this will fit nicely with #81. |
... over use of target_arch, as with Nitro and upcoming Linux support this is now ambiguous.
56d95a9
to
603edfe
Compare
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…go.toml files Removed [target.'cfg(target_env = "XXX")'.dependencies], and similar, from Cargo.toml files in favour of optional dependencies selected by Cargo features.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
…rom build.rs files Used features instead of querying of the target-triple in build.rs files for runtime-manager and veracruz-server. Removed superfluous dev-dependency from Cargo.toml file for runtime-manager and veracruz-server.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
+1 reached, merging |
Remove platform-specific conditional dependencies of the form
from various Cargo.toml files. With the move to support AArch64 and X64 Linux processes as a backend these are no longer appropriate. Instead, adopted optional dependencies selected by feature flags to select backend-specific dependencies.