Skip to content

Commit cd40666

Browse files
Googlercopybara-github
Googler
authored andcommitted
replace _get_canonical_form(label) with str(label)
Fixes a bug where the label returned from _get_canonical_form() was missing a leading @. Now that `--incompatible_unambiguous_label_stringification=true` is on by default, str(label) already returns the appropriate target label. RELNOTES: Fixes a bug where some compilation flags would not be applied to a cc_test PiperOrigin-RevId: 491632546 Change-Id: Ib00d7004636283c9d39d9612d7fe2e5e31429653
1 parent 0b15a07 commit cd40666

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/main/starlark/builtins_bzl/common/cc/cc_binary.bzl

+1-7
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,6 @@ def _get_preloaded_deps_from_dynamic_deps(ctx):
366366

367367
return cc_common.merge_cc_infos(direct_cc_infos = cc_infos, cc_infos = cc_infos).linking_context.linker_inputs.to_list()
368368

369-
def _get_canonical_form(label):
370-
repository = label.workspace_name
371-
if repository == "@":
372-
repository = ""
373-
return repository + "//" + label.package + ":" + label.name
374-
375369
def _filter_libraries_that_are_linked_dynamically(ctx, cc_linking_context, cpp_config):
376370
merged_cc_shared_library_infos = merge_cc_shared_library_infos(ctx)
377371
preloaded_deps = _get_preloaded_deps_from_dynamic_deps(ctx)
@@ -399,7 +393,7 @@ def _filter_libraries_that_are_linked_dynamically(ctx, cc_linking_context, cpp_c
399393
continue
400394
linker_inputs_seen[stringified_linker_input] = True
401395
owner = str(linker_input.owner)
402-
if owner not in link_dynamically_labels and (owner in link_statically_labels or _get_canonical_form(ctx.label) == owner):
396+
if owner not in link_dynamically_labels and (owner in link_statically_labels or str(ctx.label) == owner):
403397
if owner in link_once_static_libs_map:
404398
linked_statically_but_not_exported.setdefault(link_once_static_libs_map[owner], []).append(owner)
405399
else:

0 commit comments

Comments
 (0)