-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix genrule autostamping #21407
Fix genrule autostamping #21407
Conversation
Also noticed that the documentation says:
This is not true for genrule. Wonder if that is intentional since there's is a test verifying that. |
This is awesome, thank you @AlessandroPatti. The documentation on stamp functionality is not exactly complete/consistent, I can confirm |
Thanks for the fix. I'm going to patch this and modify it slightly to better converge with the google-internal genrule implementation.
Which test are you referring to? This is a bit of a concern for breaking users that rely on stamped genrules in the exec config, but that is not working as intended. Edit: after further research, it does appear that this is WAI. Genrules are treated differently than binaries, see following comment. |
Also note that the linked documentation refers to binaries when talking about the exec configuration, not genrules. Internally, genrules are also currently allowed to be stamped (with |
Line 562 in 7f7017a
Line 573 in 7f7017a
@justinhorvitz indeed this would be a breaking change and would likely require an incompatible flag, that is why I left it out of this pr, but wanted to call it out.
True, it mentions binaries only. Still, I find it odd that binaries and genrule behave differently and it seems desirable for tools to not be stamped to avoid massive cache invalidations. However, if this is the intended behaviour, maybe worth calling out explicitly in the documentation that this is not the case for genrules (what about starlark rules?)? |
Thanks, it took me a bit to realize that you left the exec configuration change out of this PR, but we're on the same page now. I have it out for review. Most likely it was initially an oversight to allow stamping in the exec (back then host) configuration for genrules. In general, there are a lot of legacy issues with the stamp feature, and if we could redesign it from scratch it would look totally different (no per-rule attributes, only a per-build flag). Starlark actions are also a mess with stamping. They allow unconditional access to the stamp files via |
Isolate two `@ForOverride` methods and make everything else `private` to make it clear what behavior may diverge between bazel and blaze. PiperOrigin-RevId: 608999251 Change-Id: I16343d4a1b538d9c13544661ec421f13bf9b1c40
@bazel-io flag |
@bazel-io fork 7.1.0 |
Genrule does not support conditional stamping based on the value of the `--stamp` flag. This is because genrule treats the `stamp` attribute as `boolean`, while all other rules use the `tristate` type. After this change, the stamp attribute in genrule can be set to `-1` to request conditional stamping. RELNOTES: `genrule` now supports setting `stamp = -1` to request conditional stamping (based on the value of the build's `--stamp` flag). Closes bazelbuild#21407. PiperOrigin-RevId: 609085052 Change-Id: I873941e9aaae3760a545c1900cd13cb60a9ada39
Isolate two `@ForOverride` methods and make everything else `private` to make it clear what behavior may diverge between bazel and blaze. PiperOrigin-RevId: 608999251 Change-Id: I16343d4a1b538d9c13544661ec421f13bf9b1c40
Genrule does not support conditional stamping based on the value of the `--stamp` flag. This is because genrule treats the `stamp` attribute as `boolean`, while all other rules use the `tristate` type. After this change, the stamp attribute in genrule can be set to `-1` to request conditional stamping. RELNOTES: `genrule` now supports setting `stamp = -1` to request conditional stamping (based on the value of the build's `--stamp` flag). Closes bazelbuild#21407. PiperOrigin-RevId: 609085052 Change-Id: I873941e9aaae3760a545c1900cd13cb60a9ada39
Genrule does not support conditional stamping based on the value of the `--stamp` flag. This is because genrule treats the `stamp` attribute as `boolean`, while all other rules use the `tristate` type. After this change, the stamp attribute in genrule can be set to `-1` to request conditional stamping. RELNOTES: `genrule` now supports setting `stamp = -1` to request conditional stamping (based on the value of the build's `--stamp` flag). Closes #21407. Commit cb901b7, ee57d99 PiperOrigin-RevId: 609085052 Change-Id: I873941e9aaae3760a545c1900cd13cb60a9ada39 --------- Co-authored-by: Googler <[email protected]> Co-authored-by: Alessandro Patti <[email protected]>
The changes in this PR have been included in Bazel 7.1.0 RC2. Please test out the release candidate and report any issues as soon as possible. |
Genrule does not support conditional stamping based on the value of the
--stamp
flag. This is because genrule treats thestamp
attribute asboolean
, while all other rules use thetristate
type. After this change, the stamp attribute in genrule can be set to-1
to request conditional stamping.