Conversation
Pass producer-specific output directory tokens to the build script runner and normalize configuration-specific bazel-out paths in generated link flags. Keep substitution values File-backed so Bazel path mapping can share Rust actions across configurations.
Verify nested output paths and identical flags across output configurations. Strengthen transitive substitution coverage to reject configuration-specific keys.
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.
Motivation
Cargo build scripts can emit linker flags and search paths containing
bazel-out/<configuration>paths. Since these values are written to generatedflag files, Bazel cannot rewrite them later. The current substitution keys also
use full analysis-time
out_dirpaths, making the flag files configurationdependent.
Proposed change
Use stable, producer-specific substitution keys derived from
out_dir.short_path, normalize embedded output paths tobazel-out/cfg, andkeep the corresponding
--substvaluesFile-backed for runtime path mapping.This preserves uniqueness between build scripts while allowing equivalent
configurations to share generated flag files.
Related work
rules_rust#4253
addresses C++ linker and sysroot paths passed as strings. This change covers
Cargo build-script-generated linker flags and search paths.
Testing
Updated runner tests for stable substitution keys, mapped
bazel-outpaths, andexisting regular-path behavior.