From 003fbffa4572d6ce8f50143e47c0731aaaf08eb9 Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 12 Oct 2023 21:54:47 -0700 Subject: [PATCH] Rollforward of https://github.com/bazelbuild/bazel/commit/10a46b1e85f0b5bf8564c125dd02cd4e70017452: Remove legacy allowlist names NEW: Maintainers of the repos had 1 month to upgrade version of rules Go https://github.com/bazelbuild/bazel/issues/19493 NEW: syncing against code changes PiperOrigin-RevId: 573099651 Change-Id: I517e45a83989bfa24f6487ef6d89d60aeb31e4d3 --- .../lib/analysis/CommonPrerequisiteValidator.java | 1 - .../analysis/starlark/StarlarkRuleClassFunctions.java | 11 ++--------- .../packages/FunctionSplitTransitionAllowlist.java | 3 --- .../rules/cpp/CcImportBaseConfiguredTargetTest.java | 2 +- .../lib/rules/cpp/CcLibraryConfiguredTargetTest.java | 2 +- src/test/shell/integration/cpp_test.sh | 2 +- ...tarlark_configurations_external_workspaces_test.sh | 4 ++-- 7 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/CommonPrerequisiteValidator.java b/src/main/java/com/google/devtools/build/lib/analysis/CommonPrerequisiteValidator.java index 3e077da0369bd1..4726c97cb7eaa9 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/CommonPrerequisiteValidator.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/CommonPrerequisiteValidator.java @@ -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, diff --git a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java index cd3e6ba6829d05..1a80d705ec3da6 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/starlark/StarlarkRuleClassFunctions.java @@ -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"); } @@ -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); diff --git a/src/main/java/com/google/devtools/build/lib/packages/FunctionSplitTransitionAllowlist.java b/src/main/java/com/google/devtools/build/lib/packages/FunctionSplitTransitionAllowlist.java index ad954e7898e173..6a6b0ab83435fa 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/FunctionSplitTransitionAllowlist.java +++ b/src/main/java/com/google/devtools/build/lib/packages/FunctionSplitTransitionAllowlist.java @@ -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() {} } diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcImportBaseConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcImportBaseConfiguredTargetTest.java index d53d9c085c0ebc..c4038b1c67f908 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcImportBaseConfiguredTargetTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcImportBaseConfiguredTargetTest.java @@ -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),", diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java index dab629f4ecf0c6..d89b7c43291cec 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java @@ -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),", diff --git a/src/test/shell/integration/cpp_test.sh b/src/test/shell/integration/cpp_test.sh index 4d49349bad63bd..ca60286d686cd3 100755 --- a/src/test/shell/integration/cpp_test.sh +++ b/src/test/shell/integration/cpp_test.sh @@ -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"), }, ) diff --git a/src/test/shell/integration/starlark_configurations_external_workspaces_test.sh b/src/test/shell/integration/starlark_configurations_external_workspaces_test.sh index e09eaf752900a2..ed928a48f5f09c 100755 --- a/src/test/shell/integration/starlark_configurations_external_workspaces_test.sh +++ b/src/test/shell/integration/starlark_configurations_external_workspaces_test.sh @@ -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