Flip incompatible_enable_cc_toolchain_resolution
RELNOTES[INC]: Flip incompatible_enable_cc_toolchain_resolution (https://github.com/bazelbuild/bazel/issues/7260)
Closes #16252.
PiperOrigin-RevId: 476058407
Change-Id: I6ceb9cd306e0eeed61cb1ff8cd9804d26988d22d
diff --git a/MODULE.bazel b/MODULE.bazel
index 4fbbc50..fe77ed6 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -18,7 +18,7 @@
bazel_dep(name = "zstd-jni", version = "1.5.0-4")
# The following are required when building without WORKSPACE SUFFIX
-bazel_dep(name = "rules_cc", version = "0.0.1")
+bazel_dep(name = "rules_cc", version = "0.0.2")
bazel_dep(name = "rules_java", version = "5.1.0")
bazel_dep(name = "rules_proto", version = "4.0.0")
diff --git a/distdir_deps.bzl b/distdir_deps.bzl
index 1c4e8d9..15e604e 100644
--- a/distdir_deps.bzl
+++ b/distdir_deps.bzl
@@ -52,13 +52,9 @@
# Used in src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
# Used in src/test/java/com/google/devtools/build/lib/blackbox/framework/blackbox.WORKSAPCE
"rules_cc": {
- "archive": "b1c40e1de81913a3c40e5948f78719c28152486d.zip",
- "sha256": "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
- "strip_prefix": "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
- "urls": [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
- "https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
- ],
+ "archive": "rules_cc-0.0.2.tar.gz",
+ "sha256": "58bff40957ace85c2de21ebfc72e53ed3a0d33af8cc20abd0ceec55c63be7de2",
+ "urls": ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.2/rules_cc-0.0.2.tar.gz"],
"used_in": [
"additional_distfiles",
"test_WORKSPACE_files",
diff --git a/src/MODULE.tools b/src/MODULE.tools
index bc8b9c2..fdd9993 100644
--- a/src/MODULE.tools
+++ b/src/MODULE.tools
@@ -1,6 +1,6 @@
module(name = "bazel_tools")
-bazel_dep(name = "rules_cc", version = "0.0.1")
+bazel_dep(name = "rules_cc", version = "0.0.2")
bazel_dep(name = "rules_java", version = "5.1.0")
bazel_dep(name = "rules_license", version = "0.0.3")
bazel_dep(name = "rules_proto", version = "4.0.0")
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 2be96b1..7422385 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
@@ -878,7 +878,7 @@
@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/rules/cpp/CcImportBaseConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcImportBaseConfiguredTargetTest.java
index d06b9a8..59c7819 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
@@ -165,7 +165,7 @@
@Test
public void testCcImportWithSharedLibrary() throws Exception {
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target =
scratchConfiguredTarget(
"a",
@@ -192,7 +192,7 @@
@Test
public void testCcImportWithVersionedSharedLibrary() throws Exception {
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target =
scratchConfiguredTarget(
"a",
@@ -219,7 +219,7 @@
@Test
public void testCcImportWithVersionedSharedLibraryWithDotInTheName() throws Exception {
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target =
scratchConfiguredTarget(
@@ -274,7 +274,7 @@
@Test
public void testCcImportWithInterfaceSharedLibrary() throws Exception {
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target =
scratchConfiguredTarget(
"b",
@@ -302,7 +302,7 @@
@Test
public void testCcImportWithBothStaticAndSharedLibraries() throws Exception {
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target =
scratchConfiguredTarget(
"a",
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 e02bc53..1f30036 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
@@ -666,7 +666,7 @@
scratch.file("a/BUILD", "cc_toolchain_alias(name = 'b')");
scratch.file("libc1/BUILD", "filegroup(name = 'everything', srcs = ['header1.h'])");
scratch.file("libc1/header1.h", "#define FOO 1");
- useConfiguration();
+ useConfiguration("--noincompatible_enable_cc_toolchain_resolution");
ConfiguredTarget target = getConfiguredTarget("//a:b");
CcToolchainProvider toolchainProvider = target.get(CcToolchainProvider.PROVIDER);
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariablesTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariablesTest.java
index b4d89cc..2a1b246 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariablesTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CompileBuildVariablesTest.java
@@ -129,7 +129,10 @@
@Test
public void testTargetSysrootWithoutPlatforms() throws Exception {
- useConfiguration("--grte_top=//target_libc", "--host_grte_top=//host_libc");
+ useConfiguration(
+ "--grte_top=//target_libc",
+ "--host_grte_top=//host_libc",
+ "--noincompatible_enable_cc_toolchain_resolution");
scratch.file("x/BUILD", "cc_binary(name = 'bin', srcs = ['bin.cc'])");
scratch.file("x/bin.cc");
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppSysrootTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppSysrootTest.java
index cda1294..49a8e7d 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CppSysrootTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CppSysrootTest.java
@@ -67,7 +67,8 @@
@Test
public void testHostGrteTop() throws Exception {
scratch.file("a/grte/top/BUILD", "filegroup(name='everything')", "cc_library(name='library')");
- useConfiguration("--host_grte_top=//a/grte/top");
+ useConfiguration(
+ "--host_grte_top=//a/grte/top", "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue target = getTargetConfiguration();
CcToolchainProvider targetCcProvider = getCcToolchainProvider(target);
BuildConfigurationValue host = getHostConfiguration();
@@ -81,7 +82,10 @@
public void testOverrideHostGrteTop() throws Exception {
scratch.file("a/grte/top/BUILD", "filegroup(name='everything')");
scratch.file("b/grte/top/BUILD", "filegroup(name='everything')");
- useConfiguration("--grte_top=//a/grte/top", "--host_grte_top=//b/grte/top");
+ useConfiguration(
+ "--grte_top=//a/grte/top",
+ "--host_grte_top=//b/grte/top",
+ "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue target = getTargetConfiguration();
CcToolchainProvider targetCcProvider = getCcToolchainProvider(target);
BuildConfigurationValue host = getHostConfiguration();
@@ -100,7 +104,7 @@
public void testGrteTopAlias() throws Exception {
scratch.file("a/grte/top/BUILD", "filegroup(name='everything')");
scratch.file("b/grte/top/BUILD", "alias(name='everything', actual='//a/grte/top:everything')");
- useConfiguration("--grte_top=//b/grte/top");
+ useConfiguration("--grte_top=//b/grte/top", "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue target = getTargetConfiguration();
CcToolchainProvider targetCcProvider = getCcToolchainProvider(target);
@@ -113,13 +117,16 @@
@Test
public void testSysroot() throws Exception {
// BuildConfigurationValue shouldn't provide a sysroot option by default.
- useConfiguration("--cpu=k8");
+ useConfiguration("--cpu=k8", "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue config = getTargetConfiguration();
testCCFlagsContainsSysroot(config, "/usr/grte/v1", true);
scratch.file("a/grte/top/BUILD", "filegroup(name='everything')");
// BuildConfigurationValue should work with label grte_top options.
- useConfiguration("--cpu=k8", "--grte_top=//a/grte/top:everything");
+ useConfiguration(
+ "--cpu=k8",
+ "--grte_top=//a/grte/top:everything",
+ "--noincompatible_enable_cc_toolchain_resolution");
config = getTargetConfiguration();
testCCFlagsContainsSysroot(config, "a/grte/top", true);
}
@@ -132,7 +139,8 @@
mockToolsConfig,
CcToolchainConfig.builder().withActionConfigs("sysroot_in_action_config"));
scratch.overwriteFile("a/grte/top/BUILD", "filegroup(name='everything')");
- useConfiguration("--grte_top=//a/grte/top:everything");
+ useConfiguration(
+ "--grte_top=//a/grte/top:everything", "--noincompatible_enable_cc_toolchain_resolution");
RuleContext ruleContext =
getRuleContext(getConfiguredTarget(Label.parseCanonical("//dummy:library"), targetConfig));
ConfigurationMakeVariableContext context =
@@ -150,20 +158,26 @@
public void testSysrootWithHostConfig() throws Exception {
// The host BuildConfigurationValue shouldn't provide a sysroot option by default.
for (String cpu : new String[] {"piii", "k8"}) {
- useConfiguration("--cpu=" + cpu);
+ useConfiguration("--cpu=" + cpu, "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue config = getHostConfiguration();
testCCFlagsContainsSysroot(config, "/usr/grte/v1", true);
}
// The host BuildConfigurationValue should work with label grte_top options.
scratch.file("a/grte/top/BUILD", "filegroup(name='everything')");
for (String cpu : new String[] {"piii", "k8"}) {
- useConfiguration("--cpu=" + cpu, "--host_grte_top=//a/grte/top");
+ useConfiguration(
+ "--cpu=" + cpu,
+ "--host_grte_top=//a/grte/top",
+ "--noincompatible_enable_cc_toolchain_resolution");
BuildConfigurationValue config = getHostConfiguration();
testCCFlagsContainsSysroot(config, "a/grte/top", true);
// "--grte_top" does *not* set the host grte_top,
// so we don't get "a/grte/top" here, but instead the default "/usr/grte/v1"
- useConfiguration("--cpu=" + cpu, "--grte_top=//a/grte/top");
+ useConfiguration(
+ "--cpu=" + cpu,
+ "--grte_top=//a/grte/top",
+ "--noincompatible_enable_cc_toolchain_resolution");
config = getHostConfiguration();
testCCFlagsContainsSysroot(config, "/usr/grte/v1", true);
@@ -172,7 +186,8 @@
useConfiguration(
"--cpu=" + cpu,
"--grte_top=//a/grte/top",
- "--host_crosstool_top=" + analysisMock.ccSupport().getMockCrosstoolLabel());
+ "--host_crosstool_top=" + analysisMock.ccSupport().getMockCrosstoolLabel(),
+ "--noincompatible_enable_cc_toolchain_resolution");
config = getHostConfiguration();
testCCFlagsContainsSysroot(config, "/usr/grte/v1", true);
}
@@ -194,11 +209,15 @@
" '//conditions:default' : '//b/grte/top:everything'}",
" )",
")");
- useConfiguration("--grte_top=//c/grte/top:everything");
+ useConfiguration(
+ "--grte_top=//c/grte/top:everything", "--noincompatible_enable_cc_toolchain_resolution");
CcToolchainProvider ccProvider = getCcToolchainProvider(getTargetConfiguration());
assertThat(ccProvider.getSysroot()).isEqualTo("b/grte/top");
- useConfiguration("--grte_top=//c/grte/top:everything", "--define=override_grte_top=1");
+ useConfiguration(
+ "--grte_top=//c/grte/top:everything",
+ "--define=override_grte_top=1",
+ "--noincompatible_enable_cc_toolchain_resolution");
ccProvider = getCcToolchainProvider(getTargetConfiguration());
assertThat(ccProvider.getSysroot()).isEqualTo("a/grte/top");
}
diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py
index 6d9ca54..64b654b 100644
--- a/src/test/py/bazel/bazel_windows_cpp_test.py
+++ b/src/test/py/bazel/bazel_windows_cpp_test.py
@@ -893,8 +893,10 @@
' return 0;',
'}',
])
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--cpu=x64_x86_windows', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--cpu=x64_x86_windows',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('x86\\cl.exe', '\n'.join(stderr))
@@ -911,8 +913,10 @@
' return 0;',
'}',
])
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--cpu=x64_arm_windows', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--cpu=x64_arm_windows',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('arm\\cl.exe', '\n'.join(stderr))
@@ -929,8 +933,10 @@
' return 0;',
'}',
])
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--cpu=x64_arm64_windows', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--cpu=x64_arm64_windows',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('arm64\\cl.exe', '\n'.join(stderr))
@@ -949,8 +955,10 @@
])
# Test build without debug and optimize modes.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=mingw-gcc', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=mingw-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('mingw64\\bin\\gcc', '\n'.join(stderr))
self.assertNotIn('-g -Og', ''.join(stderr))
@@ -959,8 +967,11 @@
self.assertNotIn('-Wl,--gc-sections', ''.join(stderr))
# Test build in debug mode.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=mingw-gcc', '-c', 'dbg', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=mingw-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '-c', 'dbg',
+ '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('mingw64\\bin\\gcc', '\n'.join(stderr))
self.assertIn('-g -Og', ''.join(stderr))
@@ -969,8 +980,11 @@
self.assertNotIn('-Wl,--gc-sections', ''.join(stderr))
# Test build in optimize mode.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=mingw-gcc', '-c', 'opt', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=mingw-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '-c', 'opt',
+ '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('mingw64\\bin\\gcc', '\n'.join(stderr))
self.assertNotIn('-g -Og', ''.join(stderr))
@@ -996,8 +1010,10 @@
paramfile = 'x64_windows-%s/bin/main.exe-2.params'
# Test build without debug and optimize modes.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=msys-gcc', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=msys-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('usr\\bin\\gcc', '\n'.join(stderr))
self.assertNotIn('-g -Og', ''.join(stderr))
@@ -1008,8 +1024,11 @@
'-Wl,--gc-sections')
# Test build in debug mode.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=msys-gcc', '-c', 'dbg', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=msys-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '-c', 'dbg',
+ '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('usr\\bin\\gcc', '\n'.join(stderr))
self.assertIn('-g -Og', ''.join(stderr))
@@ -1019,8 +1038,11 @@
os.path.join(bazel_output, paramfile % 'dbg'), '-Wl,--gc-sections')
# Test build in optimize mode.
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--compiler=msys-gcc', '-c', 'opt', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--compiler=msys-gcc',
+ '--noincompatible_enable_cc_toolchain_resolution', '-c', 'opt',
+ '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('usr\\bin\\gcc', '\n'.join(stderr))
self.assertNotIn('-g -Og', ''.join(stderr))
@@ -1042,8 +1064,10 @@
' return 0;',
'}',
])
- exit_code, _, stderr = self.RunBazel(
- ['build', '-s', '--cpu=arm64_windows', '//:main'])
+ exit_code, _, stderr = self.RunBazel([
+ 'build', '-s', '--cpu=arm64_windows',
+ '--noincompatible_enable_cc_toolchain_resolution', '//:main'
+ ])
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('arm64\\cl.exe', ''.join(stderr))
diff --git a/src/test/py/bazel/bazel_windows_test.py b/src/test/py/bazel/bazel_windows_test.py
index 126ecff..7701329 100644
--- a/src/test/py/bazel/bazel_windows_test.py
+++ b/src/test/py/bazel/bazel_windows_test.py
@@ -34,8 +34,12 @@
self.createProjectFiles()
exit_code, _, stderr = self.RunBazel([
- '--batch', '--host_jvm_args=-Dbazel.windows_unix_root=', 'build',
- '//foo:x', '--cpu=x64_windows_msys'
+ '--batch',
+ '--host_jvm_args=-Dbazel.windows_unix_root=',
+ 'build',
+ '//foo:x',
+ '--cpu=x64_windows_msys',
+ '--noincompatible_enable_cc_toolchain_resolution',
])
self.AssertExitCode(exit_code, 37, stderr)
self.assertIn('"bazel.windows_unix_root" JVM flag is not set',
diff --git a/src/test/py/bazel/testdata/runfiles_test/WORKSPACE.mock b/src/test/py/bazel/testdata/runfiles_test/WORKSPACE.mock
index cfcd61d..ab999a9 100644
--- a/src/test/py/bazel/testdata/runfiles_test/WORKSPACE.mock
+++ b/src/test/py/bazel/testdata/runfiles_test/WORKSPACE.mock
@@ -4,10 +4,8 @@
http_archive(
name = "rules_cc",
- sha256 = "1d4dbbd1e1e9b57d40bb0ade51c9e882da7658d5bfbf22bbd15b68e7879d761f",
- strip_prefix = "rules_cc-8bd6cd75d03c01bb82561a96d9c1f9f7157b13d0",
+ sha256 = "58bff40957ace85c2de21ebfc72e53ed3a0d33af8cc20abd0ceec55c63be7de2",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/8bd6cd75d03c01bb82561a96d9c1f9f7157b13d0.zip",
- "https://github.com/bazelbuild/rules_cc/archive/8bd6cd75d03c01bb82561a96d9c1f9f7157b13d0.zip",
+ "https://github.com/bazelbuild/rules_cc/releases/download/0.0.2/rules_cc-0.0.2.tar.gz",
],
)
diff --git a/src/test/shell/bazel/android/aapt_integration_test.sh b/src/test/shell/bazel/android/aapt_integration_test.sh
index 99016c0..9fc17f7 100755
--- a/src/test/shell/bazel/android/aapt_integration_test.sh
+++ b/src/test/shell/bazel/android/aapt_integration_test.sh
@@ -46,9 +46,7 @@
# (bazelbuild/continuous-integration#578).
add_to_bazelrc "build --incompatible_use_python_toolchains=false"
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function test_build_with_aapt2() {
create_new_workspace
diff --git a/src/test/shell/bazel/android/aar_integration_test.sh b/src/test/shell/bazel/android/aar_integration_test.sh
index ed1dd1b..3d83859 100755
--- a/src/test/shell/bazel/android/aar_integration_test.sh
+++ b/src/test/shell/bazel/android/aar_integration_test.sh
@@ -33,9 +33,7 @@
source "${CURRENT_DIR}/../../integration_test_setup.sh" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
# Regression test for https://github.com/bazelbuild/bazel/issues/1928.
function test_empty_tree_artifact_action_inputs_mount_empty_directories() {
diff --git a/src/test/shell/bazel/android/aidl_integration_test.sh b/src/test/shell/bazel/android/aidl_integration_test.sh
index 5170628..41ae3db 100755
--- a/src/test/shell/bazel/android/aidl_integration_test.sh
+++ b/src/test/shell/bazel/android/aidl_integration_test.sh
@@ -32,9 +32,7 @@
source "$(rlocation io_bazel/src/test/shell/integration_test_setup.sh)" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function test_simple_idl_srcs() {
create_new_workspace
diff --git a/src/test/shell/bazel/android/android_helper.sh b/src/test/shell/bazel/android/android_helper.sh
index 88df89e..af5d762 100755
--- a/src/test/shell/bazel/android/android_helper.sh
+++ b/src/test/shell/bazel/android/android_helper.sh
@@ -110,11 +110,18 @@
}
# Resolves Android toolchains with platforms.
-function resolve_android_toolchains_with_platforms() {
- echo "This test uses platform-based Android toolchain resolution."
- add_to_bazelrc "build --incompatible_enable_android_toolchain_resolution"
- add_to_bazelrc "build --platform_mappings=test_android_platforms/mappings"
- add_to_bazelrc "build --platforms=//test_android_platforms:simple"
+function resolve_android_toolchains() {
+ if [[ "$1" = '--with_platforms' ]]; then
+ echo "This test uses platform-based Android toolchain resolution."
+ add_to_bazelrc "build --incompatible_enable_android_toolchain_resolution"
+ add_to_bazelrc "build --incompatible_enable_cc_toolchain_resolution"
+ add_to_bazelrc "build --platform_mappings=test_android_platforms/mappings"
+ add_to_bazelrc "build --platforms=//test_android_platforms:simple"
+ else
+ echo "This test uses legacy Android toolchains."
+ add_to_bazelrc "build --noincompatible_enable_android_toolchain_resolution"
+ add_to_bazelrc "build --noincompatible_enable_cc_toolchain_resolution"
+ fi
}
setup_head_android_tools_if_exists
diff --git a/src/test/shell/bazel/android/android_instrumentation_test_integration_test.sh b/src/test/shell/bazel/android/android_instrumentation_test_integration_test.sh
index 37da120..c10c21d 100755
--- a/src/test/shell/bazel/android/android_instrumentation_test_integration_test.sh
+++ b/src/test/shell/bazel/android/android_instrumentation_test_integration_test.sh
@@ -34,9 +34,7 @@
# (bazelbuild/continuous-integration#578).
add_to_bazelrc "build --incompatible_use_python_toolchains=false"
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function setup_android_instrumentation_test_env() {
mkdir -p java/com/bin/res/values
diff --git a/src/test/shell/bazel/android/android_integration_test.sh b/src/test/shell/bazel/android/android_integration_test.sh
index 767d2f4..84293ff 100755
--- a/src/test/shell/bazel/android/android_integration_test.sh
+++ b/src/test/shell/bazel/android/android_integration_test.sh
@@ -33,9 +33,7 @@
source "${CURRENT_DIR}/../../integration_test_setup.sh" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function test_sdk_library_deps() {
create_new_workspace
diff --git a/src/test/shell/bazel/android/android_ndk_integration_test.sh b/src/test/shell/bazel/android/android_ndk_integration_test.sh
index 8968fd9..e077c00 100755
--- a/src/test/shell/bazel/android/android_ndk_integration_test.sh
+++ b/src/test/shell/bazel/android/android_ndk_integration_test.sh
@@ -38,9 +38,7 @@
source "${CURRENT_DIR}/../../integration_test_setup.sh" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains $1
function create_android_binary() {
mkdir -p java/bazel
@@ -211,6 +209,7 @@
# platform for ARM but not x86. Enabling it for x86 requires an
# Android-compatible cc toolchain in tools/cpp/BUILD.tools.
add_to_bazelrc "build --noincompatible_enable_android_toolchain_resolution"
+ add_to_bazelrc "build --noincompatible_enable_cc_toolchain_resolution"
cpus="armeabi,armeabi-v7a,arm64-v8a,x86,x86_64"
@@ -231,6 +230,7 @@
# platform for ARM but not x86. Enabling it for x86 requires an
# Android-compatible cc toolchain in tools/cpp/BUILD.tools.
add_to_bazelrc "build --noincompatible_enable_android_toolchain_resolution"
+ add_to_bazelrc "build --noincompatible_enable_cc_toolchain_resolution"
cpus="armeabi,armeabi-v7a,arm64-v8a,x86,x86_64"
@@ -253,6 +253,7 @@
# platform for ARM but not x86. Enabling it for x86 requires an
# Android-compatible cc toolchain in tools/cpp/BUILD.tools.
add_to_bazelrc "build --noincompatible_enable_android_toolchain_resolution"
+ add_to_bazelrc "build --noincompatible_enable_cc_toolchain_resolution"
cpus="armeabi,armeabi-v7a,arm64-v8a,x86,x86_64"
@@ -396,11 +397,13 @@
}
EOF
assert_build //:foo \
+ --noincompatible_enable_cc_toolchain_resolution \
--cpu=armeabi-v7a \
--crosstool_top=@androidndk//:toolchain-stlport \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain
assert_build //:foo \
+ --noincompatible_enable_cc_toolchain_resolution \
--features=compiler_param_file \
--cpu=armeabi-v7a \
--crosstool_top=@androidndk//:toolchain-stlport \
@@ -471,11 +474,13 @@
}
EOF
assert_build //:foo \
+ --noincompatible_enable_cc_toolchain_resolution \
--cpu=armeabi-v7a \
--crosstool_top=@androidndk//:toolchain-gnu-libstdcpp \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain
assert_build //:foo \
+ --noincompatible_enable_cc_toolchain_resolution \
--features=compiler_param_file \
--cpu=armeabi-v7a \
--crosstool_top=@androidndk//:toolchain-gnu-libstdcpp \
@@ -546,11 +551,13 @@
cpus="armeabi,armeabi-v7a,arm64-v8a,x86,x86_64"
assert_build //java/bazel:bin \
+ --noincompatible_enable_cc_toolchain_resolution \
--fat_apk_cpu="$cpus" \
--android_crosstool_top=@androidndk//:toolchain-libcpp \
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain
assert_build //java/bazel:bin \
+ --noincompatible_enable_cc_toolchain_resolution \
--features=compiler_param_file \
--fat_apk_cpu="$cpus" \
--android_crosstool_top=@androidndk//:toolchain-libcpp \
diff --git a/src/test/shell/bazel/android/desugarer_integration_test.sh b/src/test/shell/bazel/android/desugarer_integration_test.sh
index 598c35b..c9d3a1f 100755
--- a/src/test/shell/bazel/android/desugarer_integration_test.sh
+++ b/src/test/shell/bazel/android/desugarer_integration_test.sh
@@ -38,9 +38,7 @@
source "$(rlocation io_bazel/src/test/shell/integration_test_setup.sh)" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function create_java_8_android_binary() {
mkdir -p java/bazel
diff --git a/src/test/shell/bazel/android/proguard_integration_test.sh b/src/test/shell/bazel/android/proguard_integration_test.sh
index 5a93d24..8a322e3 100755
--- a/src/test/shell/bazel/android/proguard_integration_test.sh
+++ b/src/test/shell/bazel/android/proguard_integration_test.sh
@@ -38,9 +38,7 @@
source "$(rlocation io_bazel/src/test/shell/integration_test_setup.sh)" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function test_proguard() {
create_new_workspace
diff --git a/src/test/shell/bazel/android/resource_processing_integration_test.sh b/src/test/shell/bazel/android/resource_processing_integration_test.sh
index 7d02e16a..e49877a 100755
--- a/src/test/shell/bazel/android/resource_processing_integration_test.sh
+++ b/src/test/shell/bazel/android/resource_processing_integration_test.sh
@@ -38,9 +38,7 @@
source "$(rlocation io_bazel/src/test/shell/integration_test_setup.sh)" \
|| { echo "integration_test_setup.sh not found!" >&2; exit 1; }
-if [[ "$1" = '--with_platforms' ]]; then
- resolve_android_toolchains_with_platforms
-fi
+resolve_android_toolchains "$1"
function setup_font_resources() {
rm java/bazel/BUILD
diff --git a/src/test/shell/bazel/apple/bazel_apple_test.sh b/src/test/shell/bazel/apple/bazel_apple_test.sh
index bfca539..fe051f6 100755
--- a/src/test/shell/bazel/apple/bazel_apple_test.sh
+++ b/src/test/shell/bazel/apple/bazel_apple_test.sh
@@ -80,6 +80,7 @@
bazel build --verbose_failures --xcode_version=$XCODE_VERSION \
//package:lipo_out --ios_multi_cpus=i386,x86_64 \
+ --noincompatible_enable_cc_toolchain_resolution \
|| fail "should build starlark_apple_binary and obtain info via lipo"
cat bazel-genfiles/package/lipo_out | grep "i386 x86_64" \
@@ -126,6 +127,7 @@
bazel build --verbose_failures --xcode_version=$XCODE_VERSION \
//package:lipo_out \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_multi_cpus=i386 --ios_multi_cpus=x86_64 \
|| fail "should build starlark_apple_binary and obtain info via lipo"
@@ -257,6 +259,7 @@
EOF
bazel build --verbose_failures //package:lipo_out \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_multi_cpus=i386,x86_64 \
--xcode_version=$XCODE_VERSION \
|| fail "should build starlark_apple_binary and obtain info via lipo"
@@ -334,6 +337,7 @@
EOF
bazel build --verbose_failures //package:lipo_out \
+ --noincompatible_enable_cc_toolchain_resolution \
--watchos_cpus=armv7k \
--xcode_version=$XCODE_VERSION \
|| fail "should build watch binary"
@@ -342,6 +346,7 @@
|| fail "expected output binary to be for armv7k architecture"
bazel build --verbose_failures //package:lipo_out \
+ --noincompatible_enable_cc_toolchain_resolution \
--watchos_cpus=i386 \
--xcode_version=$XCODE_VERSION \
|| fail "should build watch binary"
@@ -469,6 +474,7 @@
EOF
bazel build --verbose_failures //package:main_binary \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_multi_cpus=i386,x86_64 \
--xcode_version=$XCODE_VERSION \
--apple_generate_dsym=true \
@@ -500,6 +506,7 @@
EOF
bazel build --verbose_failures //package:main_binary \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_multi_cpus=i386,x86_64 \
--xcode_version=$XCODE_VERSION \
--apple_generate_dsym=true \
@@ -533,6 +540,7 @@
EOF
bazel build --verbose_failures //package:static_lib \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_multi_cpus=i386,x86_64 \
--ios_minimum_os=8.0 \
--xcode_version=$XCODE_VERSION \
diff --git a/src/test/shell/bazel/apple/bazel_objc_test.sh b/src/test/shell/bazel/apple/bazel_objc_test.sh
index 42fd4ca..4f06b09 100755
--- a/src/test/shell/bazel/apple/bazel_objc_test.sh
+++ b/src/test/shell/bazel/apple/bazel_objc_test.sh
@@ -53,6 +53,7 @@
make_lib
bazel build --verbose_failures --apple_platform_type=ios \
+ --noincompatible_enable_cc_toolchain_resolution \
--ios_sdk_version=$IOS_SDK_VERSION \
//ios:lib >$TEST_log 2>&1 || fail "should pass"
ls bazel-out/*/bin/ios/liblib.a \
@@ -153,6 +154,7 @@
EOF
bazel build --verbose_failures \
+ --noincompatible_enable_cc_toolchain_resolution \
--apple_platform_type=ios \
--ios_sdk_version=$IOS_SDK_VERSION \
--objc_enable_binary_stripping=true \
diff --git a/src/test/shell/bazel/bazel_windows_example_test.sh b/src/test/shell/bazel/bazel_windows_example_test.sh
index 8942318..8c0cad4 100755
--- a/src/test/shell/bazel/bazel_windows_example_test.sh
+++ b/src/test/shell/bazel/bazel_windows_example_test.sh
@@ -117,16 +117,18 @@
local cpp_pkg=examples/cpp
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
+ --noincompatible_enable_cc_toolchain_resolution \
--compiler=msys-gcc
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib_fbaaaedd.so ${cpp_pkg}:hello-lib\
+ --noincompatible_enable_cc_toolchain_resolution \
--compiler=msys-gcc --output_groups=dynamic_library
assert_build ${cpp_pkg}:hello-world --compiler=msys-gcc
./bazel-bin/${cpp_pkg}/hello-world foo >& $TEST_log \
|| fail "./bazel-bin/${cpp_pkg}/hello-world foo execution failed"
expect_log "Hello foo"
- assert_test_ok "//examples/cpp:hello-success_test" --compiler=msys-gcc
- assert_test_fails "//examples/cpp:hello-fail_test" --compiler=msys-gcc
+ assert_test_ok "//examples/cpp:hello-success_test" --compiler=msys-gcc --noincompatible_enable_cc_toolchain_resolution
+ assert_test_fails "//examples/cpp:hello-fail_test" --compiler=msys-gcc --noincompatible_enable_cc_toolchain_resolution
}
function test_cpp_with_mingw_gcc() {
@@ -136,19 +138,24 @@
export PATH="/mingw64/bin:$PATH"
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
+ --noincompatible_enable_cc_toolchain_resolution \
--compiler=mingw-gcc --experimental_strict_action_env
assert_build_output \
./bazel-bin/${cpp_pkg}/libhello-lib_fbaaaedd.so ${cpp_pkg}:hello-lib\
+ --noincompatible_enable_cc_toolchain_resolution \
--compiler=mingw-gcc --output_groups=dynamic_library \
--experimental_strict_action_env
assert_build ${cpp_pkg}:hello-world --compiler=mingw-gcc \
+ --noincompatible_enable_cc_toolchain_resolution \
--experimental_strict_action_env
./bazel-bin/${cpp_pkg}/hello-world foo >& $TEST_log \
|| fail "./bazel-bin/${cpp_pkg}/hello-world foo execution failed"
expect_log "Hello foo"
assert_test_ok "//examples/cpp:hello-success_test" --compiler=mingw-gcc \
+ --noincompatible_enable_cc_toolchain_resolution \
--experimental_strict_action_env --test_env=PATH
assert_test_fails "//examples/cpp:hello-fail_test" --compiler=mingw-gcc \
+ --noincompatible_enable_cc_toolchain_resolution \
--experimental_strict_action_env --test_env=PATH)
}
diff --git a/src/test/shell/integration/cpp_test.sh b/src/test/shell/integration/cpp_test.sh
index d38bd2c..7752b96 100755
--- a/src/test/shell/integration/cpp_test.sh
+++ b/src/test/shell/integration/cpp_test.sh
@@ -362,6 +362,7 @@
bazel build \
+ --noincompatible_enable_cc_toolchain_resolution \
--cpu=fake --host_cpu=fake \
--crosstool_top=//$pkg/toolchain:alpha \
//$pkg:outer >& $TEST_log || fail "build failed"
diff --git a/src/test/shell/testenv.sh.tmpl b/src/test/shell/testenv.sh.tmpl
index 3559bba..fb8d963 100755
--- a/src/test/shell/testenv.sh.tmpl
+++ b/src/test/shell/testenv.sh.tmpl
@@ -371,7 +371,7 @@
# Sets up sufficient platform definitions to support Android shell tests using
# platform-based toolchain resolution.
#
-# See resolve_android_toolchains_with_platforms in
+# See resolve_android_toolchains in
# src/test/shell/bazel/android/android_helper.sh for how to platform-based
# toolchain resolution.
function setup_android_platforms() {