Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use runtime env in build script #17

Merged
merged 2 commits into from
Apr 7, 2025

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Aug 30, 2024

While build.rs runtime and compile-time environment coincide when using cargo, they may not when using other build systems (notably bazel, which is therefore unable to build a project depending on this crate).

As explained in the docs, build scripts should get their inputs from the environment at runtime, not during compilation.

Closes #22

While build.rs runtime and compile-time environment coincide when using
cargo, they may not when using other build systems (notably bazel, which
is therefore unable to build a project depending on this crate).

As explained in [the docs][], build scripts should get their inputs from
the environment at runtime, not during compilation.

[the docs]:https://doc.rust-lang.org/cargo/reference/build-scripts.html#inputs-to-the-build-script
@redsun82
Copy link
Contributor Author

👋 @wesleywiser would you mind reviewing this? For codeql we use Bazel for building, and without this the bazel rust bindings are unable to build if this crate happens to be in the dependencies. This might change in the future (i.e. rules_rust might start injecting env variables in build scripts both at compile and run time like cargo does), but for the moment we're relying on this patch here.

@tgross35 tgross35 merged commit 08528d6 into rust-lang:main Apr 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build script access environment at compile time instead of at build time
2 participants