I'm not sure if this issue/question is more appropriate for this repo/project or cargo raze, but I'll file it here as it'll likely touch upon rules_rust anyway.
There are Cargo projects with a custom build.rs that wants to execute rustc, e.g. to get the compiler version. For example, protobuf.
Is there a way to get the path, in a genrule, to rustc of the current (i.e. selected/executing) Rust toolchain?
Somewhat relatedly, the aforementioned build.rs also wants the CARGO_PKG_VERSION envvar. This is set in the toolchain, but the genrule does not (re)export it: https://github.com/google/cargo-raze/blob/8138a751a0960f7975a3d5b969667e0e68f53a7e/impl/src/templates/partials/build_script.template#L28-L52
I found that if I manually added export CARGO_PKG_VERSION=$$(CARGO_PKG_VERSION) to the genrule, it worked. Not sure that's the right/expected way to do that. Should raze export all these CARGO_* envvars to build rules? Sorry, this one is very likely a raze issue, but it's so closely related to the above that I thought I'd plop it here :).
I'm not sure if this issue/question is more appropriate for this repo/project or
cargo raze, but I'll file it here as it'll likely touch uponrules_rustanyway.There are Cargo projects with a custom
build.rsthat wants to executerustc, e.g. to get the compiler version. For example, protobuf.Is there a way to get the path, in a
genrule, torustcof the current (i.e. selected/executing) Rust toolchain?Somewhat relatedly, the aforementioned
build.rsalso wants theCARGO_PKG_VERSIONenvvar. This is set in the toolchain, but thegenruledoes not (re)export it: https://github.com/google/cargo-raze/blob/8138a751a0960f7975a3d5b969667e0e68f53a7e/impl/src/templates/partials/build_script.template#L28-L52I found that if I manually added
export CARGO_PKG_VERSION=$$(CARGO_PKG_VERSION)to thegenrule, it worked. Not sure that's the right/expected way to do that. Shouldrazeexport all theseCARGO_*envvars to build rules? Sorry, this one is very likely arazeissue, but it's so closely related to the above that I thought I'd plop it here :).