cargo_build_script_runner: parse cargo::metadata key/value pairs#3877
Merged
UebelAndre merged 1 commit intobazelbuild:mainfrom Mar 5, 2026
Merged
Conversation
UebelAndre
requested changes
Mar 3, 2026
Collaborator
UebelAndre
left a comment
There was a problem hiding this comment.
Thanks! Could you also implement an end-to-end test somewhere in //test/cargo_build_script that defines a cargo_build_script that emits this type of dep env and a consuming rust_test or other Rust rule that confirms the data is correct?
UebelAndre
approved these changes
Mar 5, 2026
Collaborator
UebelAndre
left a comment
There was a problem hiding this comment.
Looks great, thank you so much!
auto-merge was automatically disabled
March 5, 2026 00:11
Head branch was pushed to by a user without write access
40f9806 to
0645082
Compare
Contributor
Author
|
thanks so much. I just tried to do some legacy testing of the old method too. I rebased to clean up the commits since I wasn't sure how commits are squashed to |
UebelAndre
approved these changes
Mar 5, 2026
Collaborator
UebelAndre
left a comment
There was a problem hiding this comment.
Looks good to me! Thank you for the additional test case!
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.
Summary
Fix
cargo::metadata=KEY=VALUEhandling incargo_build_script_runnerso metadata keys are propagated in Cargo-compatible form.Before:
cargo::metadata=version_1_10_0=1DEP_<links>_METADATA=version_1_10_0=1After:
DEP_<links>_VERSION_1_10_0=1Changes
"metadata"parser branch inBuildScriptOutput::new.=and emitDepEnv("<KEY>=<VALUE>").metadata_directive_maps_to_dep_env_key_value.Motivation
Downstream
linksusers (for examplehdf5-metno) expect specificDEP_*metadata keys (DEP_HDF5_VERSION_*,DEP_HDF5_HAVE_*).Testing
bazel --batch test //cargo/private/cargo_build_script_runner:test --remote_executor= --remote_cache= --bes_backend= --noshow_progress --color=no --curses=nobazel test //test/cargo_build_script/metadata_dep_env:allare end to end integration testsCloses #3876.