diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainAttributesProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainAttributesProvider.java index f91a38e9c69dba..b9cc47c73a3f82 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainAttributesProvider.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CcToolchainAttributesProvider.java @@ -74,8 +74,6 @@ public class CcToolchainAttributesProvider extends NativeInfo implements HasCcTo private final NestedSet fullInputsForCrosstool; private final NestedSet fullInputsForLink; private final NestedSet coverage; - private final String compiler; - private final String cpu; private final Artifact ifsoBuilder; private final Artifact linkDynamicLibraryTool; @Nullable private final Artifact grepIncludes; @@ -115,21 +113,12 @@ public CcToolchainAttributesProvider( super(); this.ccToolchainLabel = ruleContext.getLabel(); this.toolchainIdentifier = ruleContext.attributes().get("toolchain_identifier", Type.STRING); - if (ruleContext.getFragment(CppConfiguration.class).removeCpuCompilerCcToolchainAttributes() - && (ruleContext.attributes().isAttributeValueExplicitlySpecified("cpu") - || ruleContext.attributes().isAttributeValueExplicitlySpecified("compiler"))) { - ruleContext.ruleError( - "attributes 'cpu' and 'compiler' have been deprecated, please remove them. See " - + "https://github.com/bazelbuild/bazel/issues/7075 for details."); - } // grep_includes is not supported by Bazel. String toolsRepository = ruleContext.getRuleClassProvider().getToolsRepository().getName(); this.grepIncludes = toolsRepository.isEmpty() ? ruleContext.getPrerequisiteArtifact("$grep_includes") : null; - this.cpu = ruleContext.attributes().get("cpu", Type.STRING); - this.compiler = ruleContext.attributes().get("compiler", Type.STRING); this.supportsParamFiles = ruleContext.attributes().get("supports_param_files", BOOLEAN); this.supportsHeaderParsing = ruleContext.attributes().get("supports_header_parsing", BOOLEAN); this.allFiles = getFiles(ruleContext, "all_files"); @@ -265,10 +254,6 @@ public StarlarkFunction getBuildVarsFunc(StarlarkThread thread) throws EvalExcep return ccToolchainBuildVariablesFunc; } - public String getCpu() { - return cpu; - } - public boolean isSupportsParamFiles() { return supportsParamFiles; } @@ -562,10 +547,6 @@ public Label getTargetLibcTopLabel() { return getTargetLibcTop() == null ? null : getTargetLibcTop().getLabel(); } - public String getCompiler() { - return compiler; - } - public Artifact getIfsoBuilder() { return ifsoBuilder; } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java index 68de259f05c1c0..006230a725c6d2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java @@ -696,10 +696,6 @@ public boolean useLLVMCoverageMapFormat() { return cppOptions.useLLVMCoverageMapFormat; } - public boolean removeCpuCompilerCcToolchainAttributes() { - return cppOptions.removeCpuCompilerCcToolchainAttributes; - } - @Nullable public static PathFragment computeDefaultSysroot(String builtInSysroot) { if (builtInSysroot.isEmpty()) { diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java index b785599549ab0c..e11340b54b886d 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java @@ -851,18 +851,6 @@ public Label getMemProfProfileLabel() { + "(see https://github.com/bazelbuild/bazel/issues/7362 for migration instructions).") public boolean removeLegacyWholeArchive; - @Option( - name = "incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain", - defaultValue = "true", - documentationCategory = OptionDocumentationCategory.TOOLCHAIN, - effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, - metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE}, - help = - "If true, Bazel will complain when cc_toolchain.cpu and cc_toolchain.compiler attributes " - + "are set " - + "(see https://github.com/bazelbuild/bazel/issues/7075 for migration instructions).") - public boolean removeCpuCompilerCcToolchainAttributes; - @Option( name = "incompatible_disable_legacy_cc_provider", defaultValue = "true", @@ -1189,7 +1177,6 @@ public FragmentOptions getExec() { exec.inmemoryDotdFiles = inmemoryDotdFiles; exec.disableLegacyCcProvider = disableLegacyCcProvider; - exec.removeCpuCompilerCcToolchainAttributes = removeCpuCompilerCcToolchainAttributes; exec.enableCcToolchainResolution = enableCcToolchainResolution; exec.removeLegacyWholeArchive = removeLegacyWholeArchive; exec.dontEnableHostNonhost = dontEnableHostNonhost; diff --git a/src/main/starlark/builtins_bzl/common/cc/cc_toolchain_attrs.bzl b/src/main/starlark/builtins_bzl/common/cc/cc_toolchain_attrs.bzl index 99ddb18717eecc..702898f879c39e 100644 --- a/src/main/starlark/builtins_bzl/common/cc/cc_toolchain_attrs.bzl +++ b/src/main/starlark/builtins_bzl/common/cc/cc_toolchain_attrs.bzl @@ -24,8 +24,6 @@ CcToolchainConfigInfo = _builtins.toplevel.CcToolchainConfigInfo MemProfProfileInfo = _builtins.internal.MemProfProfileInfo cc_toolchain_attrs_exec = { - "cpu": attr.string(), - "compiler": attr.string(), # buildifier: disable=attr-license "licenses": attr.license() if hasattr(attr, "license") else attr.string_list(), # buildifier: disable=attr-license diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java index e3b8c313c1fd8c..ff3a7b119890b1 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainProviderTest.java @@ -91,99 +91,6 @@ public void testStarlarkCallables() throws Exception { assertThat(usePicForDynamicLibraries).isTrue(); } - @Test - public void testRemoveCpuAndCompiler() throws Exception { - scratch.file( - "a/BUILD", - "load(':cc_toolchain_config.bzl', 'cc_toolchain_config')", - "filegroup(name = 'empty')", - "cc_toolchain_suite(", - " name = 'a_suite',", - " toolchains = { 'k8': ':a' },", - ")", - "cc_toolchain_suite(", - " name = 'b_suite',", - " toolchains = { 'k9': ':b', },", - ")", - "cc_toolchain_suite(", - " name = 'c_suite',", - " toolchains = { 'k10': ':c', },", - ")", - "cc_toolchain(", - " name = 'a',", - " cpu = 'banana',", - " all_files = ':empty',", - " ar_files = ':empty',", - " as_files = ':empty',", - " compiler_files = ':empty',", - " dwp_files = ':empty',", - " linker_files = ':empty',", - " strip_files = ':empty',", - " objcopy_files = ':empty',", - " toolchain_identifier = 'banana',", - " toolchain_config = ':banana_config',", - ")", - "cc_toolchain(", - " name = 'b',", - " compiler = 'banana',", - " all_files = ':empty',", - " ar_files = ':empty',", - " as_files = ':empty',", - " compiler_files = ':empty',", - " dwp_files = ':empty',", - " linker_files = ':empty',", - " strip_files = ':empty',", - " objcopy_files = ':empty',", - " toolchain_identifier = 'banana',", - " toolchain_config = ':banana_config',", - ")", - "cc_toolchain(", - " name = 'c',", - " all_files = ':empty',", - " ar_files = ':empty',", - " as_files = ':empty',", - " compiler_files = ':empty',", - " dwp_files = ':empty',", - " linker_files = ':empty',", - " strip_files = ':empty',", - " objcopy_files = ':empty',", - " toolchain_identifier = 'banana',", - " toolchain_config = ':banana_config',", - ")", - "cc_toolchain_config(name = 'banana_config')"); - - scratch.file("a/cc_toolchain_config.bzl", MockCcSupport.EMPTY_CC_TOOLCHAIN); - - reporter.removeHandler(failFastHandler); - useConfiguration( - "--crosstool_top=//a:a_suite", - "--cpu=k8", - "--host_cpu=k8", - "--incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain"); - assertThat(getConfiguredTarget("//a:a_suite")).isNull(); - assertContainsEvent( - "attributes 'cpu' and 'compiler' have been deprecated, please remove them."); - eventCollector.clear(); - - useConfiguration( - "--crosstool_top=//a:b_suite", - "--cpu=k9", - "--host_cpu=k9", - "--incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain"); - assertThat(getConfiguredTarget("//a:b_suite")).isNull(); - assertContainsEvent( - "attributes 'cpu' and 'compiler' have been deprecated, please remove them."); - eventCollector.clear(); - - useConfiguration( - "--crosstool_top=//a:c_suite", - "--cpu=k10", - "--host_cpu=k10", - "--incompatible_remove_cpu_and_compiler_attributes_from_cc_toolchain"); - getConfiguredTarget("//a:c_suite"); - assertNoEvents(); - } - @Test public void testToolchainAndSuiteDifferentPackages() throws Exception { scratch.file( diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java index 42282a7b589817..903bd23294cb1f 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainTest.java @@ -375,7 +375,6 @@ public void testFailWithMultipleModuleMaps() throws Exception { " toolchain_identifier = 'toolchain-identifier-k8',", " toolchain_config = ':toolchain_config',", " module_map = ':multiple-maps',", - " cpu = 'cherry',", " ar_files = 'ar-cherry',", " as_files = 'as-cherry',", " compiler_files = 'compile-cherry',",