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.
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
Rework how bazel stamping work in the repository #20881
Rework how bazel stamping work in the repository #20881
Changes from all commits
adebfaa
bc4fd07
62dcd3f
f0ec914
375a037
4df546f
bc22e8b
24903e9
595d28c
97cf2c7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like a hack. Could you make it so that if stamping is disabled, the stamp-env is not given at all? Then you can just use
std::option_env!(...)
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that this is not possible with the way rules_rust handles
rustc_env_file
: stamping is handled by replacing{BUILD_SCM_REVISION}
and others literally in the env file. If stamping is disabled, the replacement does not occur. But the content of thestamp-env.txt
file does not depend on whether stamping is enabled or not. This, admitedly, make the way stamping is handled by rustc not so useful.We could add custom feature to our rules_rust fork so that writing "{BUILD_SCM_REVISION?}" deletes the variables if not present. Maybe this could even be accepted upstream?
Alternatively, this could be achieved with some custom bazel rule to produce either an empty file or a version file, depending on whether stamping is enabled or not, and then give the target to
rustc_env_file
, but this could be more trouble than it is worth. Something like: