-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #9122 - ehuss:fix-multiple-run-custom-build, r=alexcric…
…hton Fix env/cfg set for `cargo test` and `cargo run`. There are some situations where a build script may need to run multiple times for the same package during the same `cargo` session. There was a bug in that some of the values in the `Compilation` struct didn't handle this case. The solution here is to be more careful about how this extra data is associated with `Unit`s, instead of assuming a package's build script only runs once. The things that were not being handled properly: * `Compilation::extra_env`, which is the output of `cargo:rustc-env` in build scripts. The solution here is to use the `Metadata` hash which is used elsewhere for distinguishing build script outputs. * `Compilation::cfgs`, which is the output of `cargo:rustc-cfg` in build scripts and the features to be set, and this is only used for doctests. The solution here is to just add those `--cfg` flags directly in the `Doctest` struct. The situations that cause a build script to be run multiple times: * A package needed for both the host and target. In the test here, this was accomplished with a proc-macro (which has to be `host`) and a cyclical dev dependency, but there are many other ways to trigger this. * Something built with different features (with the new feature resolver), usually due to host/target differences. * Something built with different profile settings, usually due to host/target differences. Fixes #9100
- Loading branch information
Showing
13 changed files
with
265 additions
and
148 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.