You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switch stamping detection to ctx.configuration.stamp_binaries() (#3816)
Currently, rules_rust uses a `config_setting` that matches `--stamp=1`
to detect whether the `--stamp` option is enabled in the current
configuration. This PR removes the `config_setting` in favor of calling
`ctx.configuration.stamp_binaries()`, which is restricted, but available
to rules rust because it is on the restricted starlark API allowlist:
https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/packages/BuiltinRestriction.java;l=73;drc=135a03ba5dbad5a1a26ef3bde9815ea244a093d7.
The motivation for making this change is to improve Google-internal
detection of stamped actions for cross-user caching eligibility. The
`ctx.configuration.stamp_binaries()` call is limited to the case of
`stamp = -1`, whereas the `config_setting` dependency was unconditional.
Notably, for `rust_library` rules with the default attribute of `stamp =
0`, we are now able to certify that the rule is not affected by the
`--stamp` flag value.
Google-internal bug number: 419546090
---------
Co-authored-by: Krasimir Georgiev <krasimir@google.com>
0 commit comments