sui: limit when the build script needs to be run #2026
Merged
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.
Support for embedding the git revision inside the wallet cli was added
back in 96611e0 (wallet: log git revision on start, 2022-04-22). This
was done by using a build.rs file to run a few git commands to query for
the git revision of HEAD and if the working directory was dirty or not.
The addition of this feature had the unintended consequence of causing
a ton of code to be re-build anytime any file in the
sui
crate waschanged. This is due to the fact that, by default, a build.rs file is
re-run anytime any file anywhere in the crate (integration tests and
examples included) [1].
This patch fixes this by only having cargo re-run the build script when
the build.rs file is changed.
[1] https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-changedpath