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 c0896b128e281b..6df2864dc0e417 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 @@ -911,7 +911,7 @@ public Label getMemProfProfileLabel() { @Option( name = "incompatible_enable_cc_toolchain_resolution", - defaultValue = "false", + defaultValue = "true", documentationCategory = OptionDocumentationCategory.UNDOCUMENTED, effectTags = {OptionEffectTag.LOADING_AND_ANALYSIS}, metadataTags = {OptionMetadataTag.INCOMPATIBLE_CHANGE}, diff --git a/src/test/java/com/google/devtools/build/lib/analysis/AutoExecGroupsTest.java b/src/test/java/com/google/devtools/build/lib/analysis/AutoExecGroupsTest.java index 8c5c58956ca818..46e33093684f83 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/AutoExecGroupsTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/AutoExecGroupsTest.java @@ -1626,7 +1626,7 @@ public void ccCommonLink_fileWriteActionExecutesOnFirstPlatform() throws Excepti + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1642,14 +1642,12 @@ public void ccCommonLink_fileWriteActionExecutesOnFirstPlatform() throws Excepti " return []", "custom_rule = rule(", " implementation = _impl,", - " attrs = { '_cc_toolchain': attr.label(default=Label('//test:alias')) },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", ")"); scratch.file( "test/BUILD", "load('//test:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(name = 'custom_rule_name')"); useConfiguration("--incompatible_auto_exec_groups"); @@ -1673,7 +1671,7 @@ public void ccCommonLink_cppLinkExecGroupNotDefined_cppLinkActionExecutesOnFirst + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1689,7 +1687,6 @@ public void ccCommonLink_cppLinkExecGroupNotDefined_cppLinkActionExecutesOnFirst " return []", "custom_rule = rule(", " implementation = _impl,", - " attrs = { '_cc_toolchain': attr.label(default=Label('//test:alias')) },", " exec_groups = { ", " '" + CPP_LINK_EXEC_GROUP + "': exec_group(toolchains = _use_cpp_toolchain()),", " },", @@ -1699,7 +1696,6 @@ public void ccCommonLink_cppLinkExecGroupNotDefined_cppLinkActionExecutesOnFirst scratch.file( "test/BUILD", "load('//test:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(name = 'custom_rule_name')"); useConfiguration("--incompatible_auto_exec_groups"); @@ -1723,7 +1719,7 @@ public void ccCommonLink_cppLinkExecGroupDefined_cppLinkActionExecutesOnFirstPla + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1739,7 +1735,6 @@ public void ccCommonLink_cppLinkExecGroupDefined_cppLinkActionExecutesOnFirstPla " return []", "custom_rule = rule(", " implementation = _impl,", - " attrs = { '_cc_toolchain': attr.label(default=Label('//test:alias')) },", " exec_groups = { ", " '" + CPP_LINK_EXEC_GROUP + "': exec_group(toolchains = _use_cpp_toolchain()),", " },", @@ -1749,7 +1744,6 @@ public void ccCommonLink_cppLinkExecGroupDefined_cppLinkActionExecutesOnFirstPla scratch.file( "test/BUILD", "load('//test:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(name = 'custom_rule_name')"); useConfiguration("--incompatible_auto_exec_groups"); @@ -1772,7 +1766,7 @@ public void ccCommonLink_cppLTOActionExecutesOnFirstPlatform() throws Exception + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1793,7 +1787,6 @@ public void ccCommonLink_cppLTOActionExecutesOnFirstPlatform() throws Exception " attrs = {", " 'deps': attr.label_list(),", " 'srcs': attr.label_list(allow_files = ['.cc']),", - " '_cc_toolchain': attr.label(default=Label('//test:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -1801,7 +1794,6 @@ public void ccCommonLink_cppLTOActionExecutesOnFirstPlatform() throws Exception scratch.file( "test/BUILD", "load('//test:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "cc_library(", " name = 'dep',", " srcs = ['dep.cc'],", @@ -1817,7 +1809,9 @@ public void ccCommonLink_cppLTOActionExecutesOnFirstPlatform() throws Exception .setupCcToolchainConfig( mockToolsConfig, CcToolchainConfig.builder() - .withFeatures(CppRuleClasses.THIN_LTO, CppRuleClasses.SUPPORTS_START_END_LIB)); + .withFeatures(CppRuleClasses.THIN_LTO, CppRuleClasses.SUPPORTS_START_END_LIB) + .withToolchainTargetConstraints("@//platforms:constraint_1") + .withToolchainExecConstraints("@//platforms:constraint_1")); ImmutableList actions = getActions("//test:custom_rule_name", CppLinkAction.class); ImmutableList cppLTOActions = @@ -1841,7 +1835,7 @@ public void ccCommonLink_linkstampCompileActionExecutesOnFirstPlatform() throws + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1861,7 +1855,6 @@ public void ccCommonLink_linkstampCompileActionExecutesOnFirstPlatform() throws " implementation = _impl,", " attrs = {", " 'deps': attr.label_list(),", - " '_cc_toolchain': attr.label(default=Label('//bazel_internal/test_rules/cc:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -1869,7 +1862,6 @@ public void ccCommonLink_linkstampCompileActionExecutesOnFirstPlatform() throws scratch.file( "bazel_internal/test_rules/cc/BUILD", "load('//bazel_internal/test_rules/cc:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "cc_library(", " name = 'dep',", " linkstamp = 'stamp.cc',", @@ -1900,7 +1892,7 @@ public void ccCommonCompile_cppCompileActionExecutesOnFirstPlatform() throws Exc + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1919,7 +1911,6 @@ public void ccCommonCompile_cppCompileActionExecutesOnFirstPlatform() throws Exc " implementation = _impl,", " attrs = {", " 'srcs': attr.label_list(allow_files = ['.cc']),", - " '_cc_toolchain': attr.label(default=Label('//bazel_internal/test_rules/cc:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -1927,7 +1918,6 @@ public void ccCommonCompile_cppCompileActionExecutesOnFirstPlatform() throws Exc scratch.file( "bazel_internal/test_rules/cc/BUILD", "load('//bazel_internal/test_rules/cc:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(", " name = 'custom_rule_name',", " srcs = ['custom.cc'],", @@ -1955,7 +1945,7 @@ public void ccCommonCompile_moduleActionsExecuteOnFirstPlatform() throws Excepti + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -1977,7 +1967,6 @@ public void ccCommonCompile_moduleActionsExecuteOnFirstPlatform() throws Excepti " attrs = {", " 'srcs': attr.label_list(allow_files = ['.cc']),", " 'hdrs': attr.label_list(allow_files = ['.h']),", - " '_cc_toolchain': attr.label(default=Label('//bazel_internal/test_rules/cc:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -1985,7 +1974,6 @@ public void ccCommonCompile_moduleActionsExecuteOnFirstPlatform() throws Excepti scratch.file( "bazel_internal/test_rules/cc/BUILD", "load('//bazel_internal/test_rules/cc:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(", " name = 'custom_rule_name',", " srcs = ['custom.cc'],", @@ -1996,7 +1984,9 @@ public void ccCommonCompile_moduleActionsExecuteOnFirstPlatform() throws Excepti .ccSupport() .setupCcToolchainConfig( mockToolsConfig, - CcToolchainConfig.builder().withFeatures(MockCcSupport.HEADER_MODULES_FEATURES)); + CcToolchainConfig.builder().withFeatures(MockCcSupport.HEADER_MODULES_FEATURES) + .withToolchainTargetConstraints("@//platforms:constraint_1") + .withToolchainExecConstraints("@//platforms:constraint_1")); ImmutableList cppCompileActions = getActions("//bazel_internal/test_rules/cc:custom_rule_name", CppCompileAction.class); @@ -2023,7 +2013,7 @@ public void ccCommonCompile_codeGenModuleActionExecutesOnFirstPlatform() throws + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -2044,7 +2034,6 @@ public void ccCommonCompile_codeGenModuleActionExecutesOnFirstPlatform() throws " attrs = {", " 'srcs': attr.label_list(allow_files = ['.cc']),", " 'hdrs': attr.label_list(allow_files = ['.h']),", - " '_cc_toolchain': attr.label(default=Label('//bazel_internal/test_rules/cc:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -2052,7 +2041,6 @@ public void ccCommonCompile_codeGenModuleActionExecutesOnFirstPlatform() throws scratch.file( "bazel_internal/test_rules/cc/BUILD", "load('//bazel_internal/test_rules/cc:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(", " name = 'custom_rule_name',", " srcs = ['custom.cc'],", @@ -2066,7 +2054,9 @@ public void ccCommonCompile_codeGenModuleActionExecutesOnFirstPlatform() throws .ccSupport() .setupCcToolchainConfig( mockToolsConfig, - CcToolchainConfig.builder().withFeatures(MockCcSupport.HEADER_MODULES_FEATURES)); + CcToolchainConfig.builder().withFeatures(MockCcSupport.HEADER_MODULES_FEATURES) + .withToolchainTargetConstraints("@//platforms:constraint_1") + .withToolchainExecConstraints("@//platforms:constraint_1")); ImmutableList cppCompileActions = getActions("//bazel_internal/test_rules/cc:custom_rule_name", CppCompileAction.class); @@ -2091,7 +2081,7 @@ public void ccCommonCompile_compileHeaderActionExecutesOnFirstPlatform() throws + "', mandatory = False),", " ]", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -2112,7 +2102,6 @@ public void ccCommonCompile_compileHeaderActionExecutesOnFirstPlatform() throws " attrs = {", " 'srcs': attr.label_list(allow_files = ['.cc']),", " 'hdrs': attr.label_list(allow_files = ['.h']),", - " '_cc_toolchain': attr.label(default=Label('//bazel_internal/test_rules/cc:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -2120,7 +2109,6 @@ public void ccCommonCompile_compileHeaderActionExecutesOnFirstPlatform() throws scratch.file( "bazel_internal/test_rules/cc/BUILD", "load('//bazel_internal/test_rules/cc:defs.bzl', 'custom_rule')", - "cc_toolchain_alias(name='alias')", "custom_rule(", " name = 'custom_rule_name',", " srcs = ['custom.cc'],", @@ -2131,7 +2119,9 @@ public void ccCommonCompile_compileHeaderActionExecutesOnFirstPlatform() throws .ccSupport() .setupCcToolchainConfig( mockToolsConfig, - CcToolchainConfig.builder().withFeatures(CppRuleClasses.PARSE_HEADERS)); + CcToolchainConfig.builder().withFeatures(CppRuleClasses.PARSE_HEADERS) + .withToolchainTargetConstraints("@//platforms:constraint_1") + .withToolchainExecConstraints("@//platforms:constraint_1")); ImmutableList cppCompileActions = getActions("//bazel_internal/test_rules/cc:custom_rule_name", CppCompileAction.class); @@ -2170,7 +2160,7 @@ public void ccCommonCompile_treeArtifactActionExecutesOnFirstPlatform() throws E " return [DefaultInfo(files = depset([tree]))]", "create_tree_artifact = rule(implementation = _ta_impl)", "def _impl(ctx):", - " cc_toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " cc_toolchain = ctx.toolchains['" + TestConstants.CPP_TOOLCHAIN_TYPE + "'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = cc_toolchain,", @@ -2189,7 +2179,6 @@ public void ccCommonCompile_treeArtifactActionExecutesOnFirstPlatform() throws E " implementation = _impl,", " attrs = {", " 'srcs': attr.label_list(allow_files = ['.cc']),", - " '_cc_toolchain': attr.label(default=Label('//test:alias')),", " },", " toolchains = ['//rule:toolchain_type_2'] + _use_cpp_toolchain(),", " fragments = ['cpp']", @@ -2198,7 +2187,6 @@ public void ccCommonCompile_treeArtifactActionExecutesOnFirstPlatform() throws E "test/BUILD", "package(default_visibility = ['//visibility:public'])", "load('//test:defs.bzl', 'custom_rule', 'create_tree_artifact')", - "cc_toolchain_alias(name='alias')", "create_tree_artifact(name = 'tree_artifact')", "custom_rule(", " name = 'custom_rule_name',", diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuiteTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuiteTest.java index b42908195db64a..6923c2b4e785d0 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuiteTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSuiteTest.java @@ -29,7 +29,7 @@ public class CcToolchainSuiteTest extends BuildViewTestCase { @Test public void testInvalidCpu() throws Exception { reporter.removeHandler(failFastHandler); - useConfiguration("--cpu=bogus"); + useConfiguration("--cpu=bogus", "--noincompatible_enable_cc_toolchain_resolution"); getConfiguredTarget( ruleClassProvider.getToolsRepository() + "//tools/cpp:current_cc_toolchain"); assertContainsEvent("does not contain a toolchain for cpu 'bogus'"); diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java index 1eec601fd6a0f6..2dc610f4e08fd6 100755 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java @@ -5763,7 +5763,10 @@ private static void createFiles( bzlFilePath + "/extension.bzl", "load('//myinfo:myinfo.bzl', 'MyInfo')", "def _cc_aspect_impl(target, ctx):", - " toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " if ctx.attr._cc_toolchain:", + " toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " else:", + " toolchain = ctx.toolchains['@bazel_tools//tools/cpp:toolchain_type'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = toolchain,", @@ -5795,6 +5798,7 @@ private static void createFiles( + " '@bazel_tools//tools/cpp:current_cc_toolchain'),", " },", fragments, + " toolchains = ['@bazel_tools//tools/cpp:toolchain_type']", ")", "def _cc_starlark_library_impl(ctx):", " dep_compilation_contexts = []", @@ -5802,7 +5806,10 @@ private static void createFiles( " for dep in ctx.attr._deps:", " dep_compilation_contexts.append(dep[CcInfo].compilation_context)", " dep_linking_contexts.append(dep[CcInfo].linking_context)", - " toolchain = ctx.attr._my_cc_toolchain[cc_common.CcToolchainInfo]", + " if ctx.attr._my_cc_toolchain:", + " toolchain = ctx.attr._my_cc_toolchain[cc_common.CcToolchainInfo]", + " else:", + " toolchain = ctx.toolchains['@bazel_tools//tools/cpp:toolchain_type'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain=toolchain,", @@ -5866,6 +5873,7 @@ private static void createFiles( " configuration_field(fragment = 'cpp', name = 'cc_toolchain'))", " },", fragments, + " toolchains = ['@bazel_tools//tools/cpp:toolchain_type']", ")"); scratch.file( "foo/BUILD", @@ -6369,7 +6377,10 @@ private static void createCcBinRule( extensionDirectory + "/extension.bzl", "load('//myinfo:myinfo.bzl', 'MyInfo')", "def _cc_bin_impl(ctx):", - " toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " if ctx.attr._cc_toolchain:", + " toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " else:", + " toolchain = ctx.toolchains['@bazel_tools//tools/cpp:toolchain_type'].cc", " feature_configuration = cc_common.configure_features(", " ctx = ctx,", " cc_toolchain = toolchain,", @@ -6406,6 +6417,7 @@ private static void createCcBinRule( " 'additional_outputs': attr.output_list(),", " },", fragments, + " toolchains = ['@bazel_tools//tools/cpp:toolchain_type']", ")"); } @@ -8175,7 +8187,11 @@ public void testGrepIncludesIsSetToNullInsideCcToolchain() throws Exception { scratch.file( "foo/extension.bzl", "def _cc_skylark_library_impl(ctx):", - " return [ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]]", + " if ctx.attr._cc_toolchain:", + " toolchain = ctx.attr._cc_toolchain[cc_common.CcToolchainInfo]", + " else:", + " toolchain = ctx.toolchains['@bazel_tools//tools/cpp:toolchain_type'].cc", + " return [toolchain]", "cc_skylark_library = rule(", " implementation = _cc_skylark_library_impl,", " attrs = {", @@ -8183,6 +8199,7 @@ public void testGrepIncludesIsSetToNullInsideCcToolchain() throws Exception { " configuration_field(fragment = 'cpp', name = 'cc_toolchain')),", " },", " fragments = ['cpp'],", + " toolchains = ['@bazel_tools//tools/cpp:toolchain_type']", ")"); ConfiguredTarget target = getConfiguredTarget("//foo:skylark_lib"); diff --git a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java index 8f157f437056e4..6b4eb993cb946d 100644 --- a/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java +++ b/src/test/java/com/google/devtools/build/lib/starlark/StarlarkDefinedAspectsTest.java @@ -352,7 +352,7 @@ public void aspectsPropagatingForDefaultAndImplicit() throws Exception { assertThat(names).containsAtLeast("xxx", "yyy"); // 3-4 is the C++ toolchain and alias; its name changes between Blaze and Bazel. - assertThat(names).hasSize(4); + assertThat(names).hasSize(3); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/view/java/JavaConfigurationTest.java b/src/test/java/com/google/devtools/build/lib/view/java/JavaConfigurationTest.java index 8cdc2b39044c74..0af72a8ec78eed 100644 --- a/src/test/java/com/google/devtools/build/lib/view/java/JavaConfigurationTest.java +++ b/src/test/java/com/google/devtools/build/lib/view/java/JavaConfigurationTest.java @@ -48,13 +48,13 @@ public void testJavaLauncherConfiguration() throws Exception { @Test public void testHostCrosstoolTop() throws Exception { - BuildConfigurationValue config = createConfiguration(); + BuildConfigurationValue config = createConfiguration("--noincompatible_enable_cc_toolchain_resolution"); assertThat(config.getFragment(CppConfiguration.class).getRuleProvidingCcToolchainProvider()) .isEqualTo( Label.parseCanonicalUnchecked( TestConstants.TOOLS_REPOSITORY + "//tools/cpp:toolchain")); - BuildConfigurationValue execConfig = createExec(); + BuildConfigurationValue execConfig = createExec("--noincompatible_enable_cc_toolchain_resolution"); assertThat(execConfig.getFragment(CppConfiguration.class).getRuleProvidingCcToolchainProvider()) .isEqualTo( Label.parseCanonicalUnchecked(