Rust: keep dependencies' build scripts in the target archive - #1
Merged
Merged
Conversation
A workspace crate with a build.rs added the build-script-build target name to the skip pattern, which also matched every dependency's compiled build script under target/debug/build/<dep>-<hash>/. Cargo then rebuilt each dependency with a build script and all of its dependents on every warm run. Build-script targets are no longer part of the pattern; the package name already covers the workspace's own build directories. The Rust key gains an archive revision so entries saved without the scripts are replaced instead of kept as unchanged.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A warm cargo-lambda job (https://github.com/cargo-lambda/cargo-lambda/actions/runs/36042572512) restored 4.5 GiB from main but still compiled 381 of 577 crates, starting with proc-macro2, libc and serde_core.
cargo-lambda has a
build.rs, soworkspaceArtifactsadded thebuild-script-buildtarget name to its skip pattern. That name is shared by every build script, so the pattern also dropped each dependency's compiled script undertarget/debug/build/<dep>-<hash>/build_script_build-<hash>. On restore, cargo reportedFailedToReadMetadatafor those scripts and rebuilt every dependency with a build script plus all of its dependents.build/<crate>-<hash>/directories.archive-revision: 2. Without it the key is unchanged, so existing entries would be restored and never re-saved. The first run after this restores the old entry, rebuilds once and saves; later runs are warm.build.rsand checks that a dependency's build script is kept. It fails without the fix.Reproduced locally with
CARGO_LOG=cargo::core::compiler::fingerprint=info; with the fix only the workspace crate's own files are dropped.npm testpasses (22/22).