-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add a way for build scripts to be re-run if specific environment variables change #2776
Comments
Yeah this is kinda an unfortunate situation that this is in where in theory build scripts shouldn't rely on magical environment variables like this but in practice it's what ends up happening. I know that I've definitely run into this problem quite a few times and always have to remember to clean the right package, so it's definitely annoying! cc @wycats |
I seem to remember there being a POSIX API for "shimming" a fake environment and then jumping back to a procedure with the "real" environment on the stack with a |
Any user of |
Well there currently isn't any other way to provide information to a build script, so environment variables are a necessity. This issue has bit me before, and many other people as well. |
We even have |
Would love to see |
In theory this shouldn't be too hard to implement, so tagging E-help-wanted |
What do you all think about opt-in whitelisting of environment variables, visible in |
This commit implements a new method of rerunning a build script if an environment variable changes. Environment variables are one of the primary methods of giving inputs to a build script today, and this'll help situations where if you change an env var you don't have to remember to clean out an old build directory to ensure fresh results. Closes rust-lang#2776
Implement `cargo:rerun-if-env-changed=FOO` This commit implements a new method of rerunning a build script if an environment variable changes. Environment variables are one of the primary methods of giving inputs to a build script today, and this'll help situations where if you change an env var you don't have to remember to clean out an old build directory to ensure fresh results. Closes #2776
I hit an error building
rust-openssl
, and it looks like it's not fixable without adding functionality to Cargo:sfackler/rust-openssl#406
The build script there uses
OPENSSL_{LIB,INCLUDE}_DIR
as inputs, but it doesn't get re-run if those variables were unset and are later set, or if their values change.It would be good if build scripts could tell Cargo about environment variables they use as input, and then Cargo could record the status of those env vars upon build script invocation, and use them as dependencies for re-running the build script.
The text was updated successfully, but these errors were encountered: