Skip to content

Commit

Permalink
Rollforward of bazelbuild@10a46b1: Remove legacy allowlist names
Browse files Browse the repository at this point in the history
NEW: Maintainers of the repos had 1 month to upgrade version of rules Go bazelbuild#19493
NEW: syncing against code changes
PiperOrigin-RevId: 573099651
Change-Id: I517e45a83989bfa24f6487ef6d89d60aeb31e4d3
  • Loading branch information
comius authored and copybara-github committed Oct 13, 2023
1 parent b3a83a3 commit 003fbff
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ private void checkVisibilityAttributeContents(
// TODO(plf): Add the PackageSpecificationProvider to the 'visibility' attribute.
if (!attrName.equals("visibility")
&& !attrName.equals(FunctionSplitTransitionAllowlist.ATTRIBUTE_NAME)
&& !attrName.equals(FunctionSplitTransitionAllowlist.LEGACY_ATTRIBUTE_NAME)
&& !containsPackageSpecificationProvider) {
context.attributeError(
attrName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,8 +521,7 @@ public static StarlarkRuleFunction createRule(
}
// Check for existence of the function transition allowlist attribute.
// TODO(b/121385274): remove when we stop allowlisting starlark transitions
if (name.equals(FunctionSplitTransitionAllowlist.ATTRIBUTE_NAME)
|| name.equals(FunctionSplitTransitionAllowlist.LEGACY_ATTRIBUTE_NAME)) {
if (name.equals(FunctionSplitTransitionAllowlist.ATTRIBUTE_NAME)) {
if (!BuildType.isLabelType(attr.getType())) {
throw Starlark.errorf("_allowlist_function_transition attribute must be a label type");
}
Expand All @@ -536,13 +535,7 @@ public static StarlarkRuleFunction createRule(
if (!(defaultLabel
.getPackageName()
.equals(FunctionSplitTransitionAllowlist.LABEL.getPackageName())
&& defaultLabel.getName().equals(FunctionSplitTransitionAllowlist.LABEL.getName()))
&& !(defaultLabel
.getPackageName()
.equals(FunctionSplitTransitionAllowlist.LEGACY_LABEL.getPackageName())
&& defaultLabel
.getName()
.equals(FunctionSplitTransitionAllowlist.LEGACY_LABEL.getName()))) {
&& defaultLabel.getName().equals(FunctionSplitTransitionAllowlist.LABEL.getName()))) {
throw Starlark.errorf(
"_allowlist_function_transition attribute (%s) does not have the expected value %s",
defaultLabel, FunctionSplitTransitionAllowlist.LABEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
public class FunctionSplitTransitionAllowlist {
public static final String NAME = "function_transition";
public static final String ATTRIBUTE_NAME = "$allowlist_function_transition";
public static final String LEGACY_ATTRIBUTE_NAME = "$whitelist_function_transition";
public static final Label LABEL =
Label.parseCanonicalUnchecked("//tools/allowlists/function_transition_allowlist");
public static final Label LEGACY_LABEL =
Label.parseCanonicalUnchecked("//tools/whitelists/function_transition_whitelist");

private FunctionSplitTransitionAllowlist() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public void testCcImportWithSharedLibraryWithTransitionAddsRpathEntry() throws E
"apply_custom_transition = rule(",
" implementation = _apply_custom_transition_impl,",
" attrs = {",
" '_whitelist_function_transition': attr.label(",
" '_allowlist_function_transition': attr.label(",
" default = '//tools/allowlists/function_transition_allowlist',",
" ),",
" 'deps': attr.label_list(cfg = custom_transition),",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ private void prepareCustomTransition() throws Exception {
"apply_custom_transition = rule(",
" implementation = _apply_custom_transition_impl,",
" attrs = {",
" '_whitelist_function_transition': attr.label(",
" '_allowlist_function_transition': attr.label(",
" default = '//tools/allowlists/function_transition_allowlist',",
" ),",
" 'deps': attr.label_list(cfg = custom_transition),",
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/integration/cpp_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ outer = rule(
"${TOOLS_REPOSITORY}//tools/cpp:current_cc_toolchain",
),
),
"_whitelist_function_transition": attr.label(default = "${TOOLS_REPOSITORY}//tools/whitelists/function_transition_whitelist"),
"_allowlist_function_transition": attr.label(default = "${TOOLS_REPOSITORY}//tools/allowlists/function_transition_allowlist"),
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ rule_with_transition = rule(
cfg = my_transition,
attrs = {
"src": attr.label(allow_files = True),
"_whitelist_function_transition":
attr.label(default = "@bazel_tools//tools/whitelists/function_transition_whitelist"),
"_allowlist_function_transition":
attr.label(default = "@bazel_tools//tools/allowlists/function_transition_allowlist"),
},
)
EOF
Expand Down

0 comments on commit 003fbff

Please sign in to comment.