Skip to content

Commit 25bba58

Browse files
authored
chore: access ctx.version_file to inform Bazel stamping info is needed (#1952)
This enables an optimization in Bazel et al to better track when targets actually need stamping information. Accessing the `ctx.version_file` tells Bazel the target depends on stamping information, which related systems can use to optimize processing of the build graph.
1 parent fce7354 commit 25bba58

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

python/private/common/py_executable.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ def py_executable_base_impl(ctx, *, semantics, is_test, inherited_environment =
243243
def _get_build_info(ctx, cc_toolchain):
244244
build_info_files = py_internal.cc_toolchain_build_info_files(cc_toolchain)
245245
if cc_helper.is_stamping_enabled(ctx):
246+
# Makes the target depend on BUILD_INFO_KEY, which helps to discover stamped targets
247+
# See b/326620485 for more details.
248+
ctx.version_file # buildifier: disable=no-effect
246249
return build_info_files.non_redacted_build_info_files.to_list()
247250
else:
248251
return build_info_files.redacted_build_info_files.to_list()

0 commit comments

Comments
 (0)