Skip to content

Commit e159dc3

Browse files
ted-xiecopybara-github
authored andcommitted
Fix bazel 7 compatibility bug in native_deps.bzl
PiperOrigin-RevId: 771165976 Change-Id: I064a347111435fd9d42b8307d087bc15e87f4f8d
1 parent 20ff451 commit e159dc3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

rules/native_deps.bzl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,15 @@ def _link_native_deps_if_present(ctx, cc_info, cc_toolchain, build_config, targe
363363
for input in all_inputs:
364364
needs_linking = needs_linking or _contains_code_to_link(input)
365365

366-
if not needs_linking or cc_common.configure_features(
366+
configured_features = cc_common.configure_features(
367367
ctx = ctx,
368368
cc_toolchain = cc_toolchain,
369369
unsupported_features = ctx.disabled_features,
370370
requested_features = ctx.features,
371-
).is_requested("disable_fallback_native_deps_linking"):
371+
)
372+
373+
# Note: the hasattr() call here is necessary for Bazel 7 compatibility.
374+
if not needs_linking or (hasattr(configured_features, "is_requested") and configured_features.is_requested("disable_fallback_native_deps_linking")):
372375
return None
373376

374377
# This does not need to be shareable, but we use this API to specify the

0 commit comments

Comments
 (0)