feat(build-dir): Added the Cargo version to the inputs of workspace-path-hash
#15340
+109
−24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
This PR adds the Cargo version to the hash inputs of
workspace-path-hash
build-dir template variable.We only include the major, minor, and patch parts of the version in the hash inputs to avoid including the release channel causing new nightly's from creating many new build-dirs.
See this comment in #14125
How should we test and review this PR?
I added a test for this change.
The testing approach is to run
cargo build
twice changing the versions between runs and then validating the build-dir changed between runs.Additional information
For testing I had to add a
__CARGO_TEST_CARGO_VERSION
variable as that seemed to be the easiest way to test this.Adding
__CARGO_TEST_
env vars for testing purposes appears to be an established pattern (ie.__CARGO_TESTS_ONLY_SRC_ROOT
,__CARGO_TEST_MAX_UNPACK_SIZE
, etc)r? @epage