-
Notifications
You must be signed in to change notification settings - Fork 380
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
#10125: Support multiple build targets in .cargo/config.toml #10685
#10125: Support multiple build targets in .cargo/config.toml #10685
Conversation
The most recent commit updates the tests to only run on rust 1.64.0 or higher, which is when multiple targets were stabilized. I couldn't any mention of the rust versions supported by the plugin, but there is one build with 1.53.0, which I'm taking to be the limit for compatibility. This change is compatible with versions back to 1.53.0; it's just the tests which require the recent version for the sample config to be valid. |
@vlad20012 @Undin would either of you be able to help with review on this one? Looks like you have worked before in the Cargo code I changed for this fix. It would be great to get any feedback while this work is fresh. I'm happy to implement any changes needed to get this merged. Tests were added, builds are passing. Thanks. |
src/main/kotlin/org/rust/cargo/project/model/impl/CargoProjectImpl.kt
Outdated
Show resolved
Hide resolved
src/test/kotlin/org/rust/cargo/project/model/CargoPackagesTest.kt
Outdated
Show resolved
Hide resolved
Review feedback implemented and pushed on the branch. Waiting for builds to pass. |
…toml - add tests for parsing multiple targets - change `buildTarget: String?` to `buildTargets: List<String>` in Config object and related function calls - add test for multiple custom build targets (JSON files) - use empty/singleton list as relevant defaults instead of null/host triple
f05f30a
to
cbb9542
Compare
Thanks! bors r+ |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
changelog: support multiple build.target values in .cargo/config.toml
This is a fix for #10125, where the
cargo metadata
execution fails when multiple build targets are specified in.cargo/config.toml
. Multiple build targets in config.toml were stabilized in Rust 1.64.0, as part of rust-lang/cargo#8176.As described in my comment on the issue, I have changed
buildTarget: String?
intobuildTargets: List<String>
in theCargoConfig
, as returned byCargo.getConfig()
, and used in various places which calls that function. Instead of beingnull
,buildTargets
is an empty list if build.target is not specified, which is still correctly handled (defaulted to the host triple) by the calling code.As a result,
Cargo.fetchMetadata()
now passes--filter-platform
multiple times to thecargo metadata
call, rather than an empty string, which will correctly filter the dependencies for multiple target platforms, fixing the implementation originally added in #7185.Tests have been added and updated to exercise this functionality.
This is my first time working on this project, so please feel free to adjust whatever is needed to take this forward.