Rerun build-script if important variables change. #184
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR ensures that the build script for
torch-sys
is rerun when certain environment values are changed. This is limited to environment variables that change the behaviour of the build script that cargo doesn't already know about (so not the ones set by cargo).This should prevent confusing situations like this: #182 (comment) . A clean build and or incremental build should normally be equivalent.
One downside of this PR: right now, if you build once with the right environment variables, subsequent runs of
cargo build
with the wrong environment variables won't break your build. On the other hand, this is somewhat unpredictable, as there might be other factors that lead cargo to rebuild your dependencies, and then the environment matters again.All considered, I believe it's better that changing the environment for incremental builds gets picked up by the build script.