fix(cargo_build_script): expand ${pwd} for execpaths and locations in build_script_env#4088
Open
psalaberria002 wants to merge 1 commit into
Open
fix(cargo_build_script): expand ${pwd} for execpaths and locations in build_script_env#4088psalaberria002 wants to merge 1 commit into
psalaberria002 wants to merge 1 commit into
Conversation
slackito
reviewed
Jun 17, 2026
slackito
left a comment
Collaborator
There was a problem hiding this comment.
Could you please add tests for your fix? There's a location expansion test at //test/unit/location_expansion:location_expansion_test_suite but it only covers execpath, and it does so in the rustc_flags of a rust_library target. I think you could add testing for the plural forms there.
You might also want to add another test for cargo_build_script to check that your intended use case is covered too.
…n build_script_env
Singular $(execpath ...) and $(location ...) were already prefixed with
\${pwd}/ so build_script_runner could resolve them to absolute paths at run
time. The plural forms $(execpaths ...) and $(locations ...) were silently
omitted from this handling, leaving their paths as execroot-relative.
For plural forms each macro is expanded individually (via ctx.expand_location)
and every resulting space-separated path is prefixed with \${pwd}/.
Tests: one rust_library covering all four macro forms in rustc_flags (each
referencing a distinct generated file), and a cargo_build_script test
verifying $(execpaths ...) in build_script_env is resolved to an absolute
path at run time.
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.
Singular
$(execpath ...)and$(location ...)were already prefixed with${pwd}/so build_script_runner could resolve them to absolute paths at run time. The plural forms$(execpaths ...)and$(locations ...)were silently omitted from this handling, leaving their paths as execroot-relative.For plural forms each macro is expanded individually (via ctx.expand_location) and every resulting space-separated path is prefixed with
${pwd}/.