Open n1ght-hunter opened 1 month ago
For third-party rust crates, I think we should modify cargo-bazel to set these to their actual values which we should be able to extract from the cargo metadata output or Cargo.toml file for the crate, by setting the build_script_env
attribute in the generated BUILD files. I agree that empty string fallbacks if it can't be read could be useful.
when building with cargo these env variables are injected for crates to use. https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates currently rust rules injects some of them if they exist. To work better with rust crates they all need injecting with an empty string unless the value is read from the cargo toml. many crates use the
env!()
macro to get these values and wont compile if they dont exist but are fine if they are an empty string