cargo_build_script_runner: parse cargo::metadata key/value pairs (#3877)
## Summary
Fix `cargo::metadata=KEY=VALUE` handling in `cargo_build_script_runner`
so metadata keys are propagated in Cargo-compatible form.
Before:
- `cargo::metadata=version_1_10_0=1`
- produced `DEP_<links>_METADATA=version_1_10_0=1`
After:
- same input produces `DEP_<links>_VERSION_1_10_0=1`
## Changes
- Add a `"metadata"` parser branch in `BuildScriptOutput::new`.
- Split metadata payload on first `=` and emit
`DepEnv("<KEY>=<VALUE>")`.
- Preserve fallback behavior for malformed metadata payloads.
- Add unit test: `metadata_directive_maps_to_dep_env_key_value`.
## Motivation
Downstream `links` users (for example `hdf5-metno`) expect specific
`DEP_*` 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=no`
`bazel test //test/cargo_build_script/metadata_dep_env:all` are end to
end integration tests
Closes #3876.This repository provides rules for building Rust projects with Bazel.
The fastest way to try this in an empty project is to click the green “Use this template” button on https://github.com/bazel-starters/rust.
General discussions and announcements take place in the GitHub Discussions, but there are additional places where community members gather to discuss rules_rust.
Please refer to the full documentation.