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

Moved manifest metadata tracking from fingerprint to dep info #14973

Merged

Conversation

ranger-ross
Copy link
Contributor

@ranger-ross ranger-ross commented Dec 21, 2024

What does this PR try to resolve?

Fixes #14154

Added some of the missing package metadata to the fingerprint so that rebuilds are triggered correctly.
Also updated the test to prevent a future regression.

Moved the manifest metadata tracking to use dep info in favor of fingerprint so that rebuilds are only triggered if the metadata is actually used.

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-rebuild-detection Area: rebuild detection and fingerprinting S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 21, 2024
@ranger-ross ranger-ross force-pushed the fix-metadata-not-retriggering-builds branch from 2165205 to 44931d7 Compare December 23, 2024 03:45
@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-manifest Area: Cargo.toml issues labels Dec 23, 2024
@ranger-ross ranger-ross changed the title Added readme, license, license-file, keywords, and categories to fingerprint Moved manifest metadata tracking from fingerprint to dep info Dec 23, 2024
@ranger-ross ranger-ross force-pushed the fix-metadata-not-retriggering-builds branch 2 times, most recently from 6c04032 to 43c1913 Compare December 23, 2024 16:36
let metadata = pkg.manifest().metadata();
for (key, value) in metadata.emitted_env_vars() {
cmd.env(key, value);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we move this to line 376 so env vars are added in a similar order as before?

It doesn't really matter much though. Just I am accustomed to the current order when debugging rustc invocations in cargo --verbose mode.

src/cargo/core/compiler/fingerprint/mod.rs Outdated Show resolved Hide resolved
src/cargo/core/manifest.rs Outdated Show resolved Hide resolved
@weihanglo
Copy link
Member

Huh! Didn't realize you pushed more updates.

Comment on lines 364 to 371
cmd.env("CARGO_MANIFEST_DIR", pkg.root())
.env("CARGO_MANIFEST_PATH", pkg.manifest_path())
.env("CARGO_PKG_VERSION_MAJOR", &pkg.version().major.to_string())
.env("CARGO_PKG_VERSION_MINOR", &pkg.version().minor.to_string())
.env("CARGO_PKG_VERSION_PATCH", &pkg.version().patch.to_string())
.env("CARGO_PKG_VERSION_PRE", pkg.version().pre.as_str())
.env("CARGO_PKG_VERSION", &pkg.version().to_string())
.env("CARGO_PKG_NAME", &*pkg.name())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably keep these untouched, and work on metatata for now.

They are either already tracked by other means (PackageId), or still under discussion (#8693).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean. We can revisit them later, after we figure out manifest metdata part. Doesn't need to do everything in one PR :)

src/cargo/core/compiler/fingerprint/mod.rs Show resolved Hide resolved
Comment on lines 363 to 366
match value {
Cow::Borrowed(value) => cmd.env(key, value),
Cow::Owned(ref value) => cmd.env(key, value.as_str()),
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
match value {
Cow::Borrowed(value) => cmd.env(key, value),
Cow::Owned(ref value) => cmd.env(key, value.as_str()),
};
cmd.env(key, value.as_ref());

@ranger-ross ranger-ross force-pushed the fix-metadata-not-retriggering-builds branch 2 times, most recently from 3c3901f to 6323304 Compare December 24, 2024 07:48
@rustbot rustbot added the A-git Area: anything dealing with git label Dec 24, 2024
This change moves the manifest metadata track to dep-info files
with the goal of reduce unneeded rebuilds when metadata is changed as
well fixing issues where builds are not retrigged due to metadata
changes when they should (ie. rust-lang#14154)
@ranger-ross ranger-ross force-pushed the fix-metadata-not-retriggering-builds branch from 6323304 to 3d7b154 Compare December 24, 2024 07:54
@ranger-ross
Copy link
Contributor Author

@rustbot label -A-git

@rustbot rustbot removed the A-git Area: anything dealing with git label Dec 24, 2024
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this with us!

@weihanglo weihanglo added this pull request to the merge queue Dec 24, 2024
Merged via the queue into rust-lang:master with commit 3447b11 Dec 24, 2024
20 checks passed
@ranger-ross ranger-ross deleted the fix-metadata-not-retriggering-builds branch December 25, 2024 02:29
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 25, 2024
Update cargo

6 commits in 652623b779c88fe44afede28bf7f1c9c07812511..c86f4b3a1b153218e6e50861214b0b4b4e695f23
2024-12-20 15:44:42 +0000 to 2024-12-24 17:49:48 +0000
- fix(package): check dirtiness of path fields in manifest (rust-lang/cargo#14966)
- test: make path arguments more generic and flexible (rust-lang/cargo#14979)
- Moved manifest metadata tracking from fingerprint to dep info (rust-lang/cargo#14973)
- fix: assure possibly blocking non-files (like FIFOs) won't be picked up for publishing. (rust-lang/cargo#14977)
- simplify SourceID Hash (rust-lang/cargo#14800)
- upgrade `gix` to the latest release 0.69. (rust-lang/cargo#14975)
@rustbot rustbot added this to the 1.85.0 milestone Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-manifest Area: Cargo.toml issues A-rebuild-detection Area: rebuild detection and fingerprinting 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.

Changing workspace Cargo.toml doesn't invalidate build cache for workspace members
4 participants