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

feat(build-dir): Added the Cargo version to the inputs of workspace-path-hash #15340

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ranger-ross
Copy link
Contributor

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

Verified

This commit was signed with the committer’s verified signature.
ranger-ross Ross Sullivan
@rustbot rustbot added A-configuration Area: cargo config files and env vars S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 21, 2025
@ranger-ross ranger-ross changed the title chore(build-dir): rename test to template_workspace_path_hash feat(build-dir): Added the Cargo version to the inputs of workspace-path-hash Mar 21, 2025

Verified

This commit was signed with the committer’s verified signature.
ranger-ross Ross Sullivan
…on consistency

Verified

This commit was signed with the committer’s verified signature.
ranger-ross Ross Sullivan
…path-hash`
@ranger-ross ranger-ross force-pushed the cargo-version-in-hash branch from feb5de8 to 95491b1 Compare March 21, 2025 15:05
@epage
Copy link
Contributor

epage commented Mar 25, 2025

As noted at #14125 (comment), the aspect of this PR for including the cargo version in the hash is being deferred. I've not closed this in case you want to keep this PR for just the test change.

@ranger-ross ranger-ross marked this pull request as draft April 2, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-configuration Area: cargo config files and env vars S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants