aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2018-07-26 07:44:33 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-26 07:45:49 -0700
commit74146fdbcc4eb0463e64588a764b22e253a405ac (patch)
treef37bc5ac2ae707274f1bd3fbb4a8f90682980c70 /src/test
parent676e0cd86b51e37cfa710e456b22853914c1cf0a (diff)
Add a flag to make Apple rules not share C++ compile actions.
This is accomplished by: - Setting the APPLE_CROSSTOOL configuration distinguisher in AppleCrosstoolTransition - Doing nothing in AppleCrosstoolTransition in case we are already in an Apple configuration so that funky use cases like a binary having a dependency on a swift_library both directly and through an objc_library work - Adding the "apl-" prefix to the output directory name in APPLE_CROSSTOOL configurations Plus a few minor cleanups: - Removed some unused methods - Nopped out --enable_apple_crosstool_transition if the new flag is set - Nopped out --target_uses_apple_crosstool if the new flag is set These latter reduce the possible space of Apple configurations, thus making the code a bit more comprehensible. RELNOTES: None. PiperOrigin-RevId: 206157413
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java4
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java12
-rwxr-xr-xsrc/test/shell/bazel/apple/bazel_objc_test.sh11
3 files changed, 18 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
index da2d3124b9..0501930cbb 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcProtoLibraryTest.java
@@ -461,7 +461,7 @@ public class ObjcProtoLibraryTest extends ObjcRuleTestCase {
@Test
public void testCompilationAction() throws Exception {
- useConfiguration("--cpu=ios_i386");
+ useConfiguration("--cpu=ios_i386", "--apple_crosstool_in_output_directory_name");
ApplePlatform platform = ApplePlatform.IOS_SIMULATOR;
// Because protos are linked/compiled within the apple_binary context, we need to traverse the
@@ -510,7 +510,7 @@ public class ObjcProtoLibraryTest extends ObjcRuleTestCase {
.addAll(
ObjcLibraryTest.iquoteArgs(
providerForTarget("//package:opl_binary"),
- getTargetConfiguration()))
+ getAppleCrosstoolConfiguration()))
.add("-I")
.add(sourceFile.getExecPath().getParentDirectory().getParentDirectory().toString())
.add("-fno-objc-arc")
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
index 4227116991..2090c7642a 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/ObjcRuleTestCase.java
@@ -192,6 +192,12 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
switch (configurationDistinguisher) {
case UNKNOWN:
return String.format("%s-out/ios_%s-%s/", TestConstants.PRODUCT_NAME, arch, modeSegment);
+ case APPLE_CROSSTOOL:
+ return String.format("%1$s-out/apl-ios_%2$s%3$s-%4$s/",
+ TestConstants.PRODUCT_NAME,
+ arch,
+ minOsSegment,
+ modeSegment);
case APPLEBIN_IOS:
return String.format(
"%1$s-out/ios-%2$s%4$s-%3$s-ios_%2$s-%5$s/",
@@ -2107,7 +2113,9 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
private void checkCustomModuleMap(RuleType ruleType, boolean targetUnderTestShouldPropagate)
throws Exception {
useConfiguration(
- "--experimental_objc_enable_module_maps", "--incompatible_strict_objc_module_maps");
+ "--apple_crosstool_in_output_directory_name",
+ "--experimental_objc_enable_module_maps",
+ "--incompatible_strict_objc_module_maps");
ruleType.scratchTarget(scratch, "deps", "['//z:a']");
scratch.file("z/a.m");
scratch.file("z/a.h");
@@ -2139,7 +2147,7 @@ public abstract class ObjcRuleTestCase extends BuildViewTestCase {
assertThat(compileActionA.getArguments()).doesNotContain("-fmodule-name");
String x8664Genfiles =
- configurationGenfiles("x86_64", ConfigurationDistinguisher.UNKNOWN, null);
+ configurationGenfiles("x86_64", ConfigurationDistinguisher.APPLE_CROSSTOOL, null);
// The target with the module map should propagate it to its direct dependers...
ObjcProvider provider = providerForTarget("//z:testModuleMap");
diff --git a/src/test/shell/bazel/apple/bazel_objc_test.sh b/src/test/shell/bazel/apple/bazel_objc_test.sh
index e60c98b957..09dd0536ff 100755
--- a/src/test/shell/bazel/apple/bazel_objc_test.sh
+++ b/src/test/shell/bazel/apple/bazel_objc_test.sh
@@ -49,9 +49,10 @@ function test_build_app() {
setup_objc_test_support
make_lib
- bazel build --verbose_failures --ios_sdk_version=$IOS_SDK_VERSION \
+ bazel build --verbose_failures --apple_crosstool_in_output_directory_name \
+ --ios_sdk_version=$IOS_SDK_VERSION \
//ios:lib >$TEST_log 2>&1 || fail "should pass"
- ls bazel-out/ios_x86_64-fastbuild/bin/ios/liblib.a \
+ ls bazel-out/apl-ios_x86_64-fastbuild/bin/ios/liblib.a \
|| fail "should generate lib.a"
}
@@ -101,7 +102,7 @@ int aFunction() {
}
EOF
- bazel build --verbose_failures --apple_crosstool_transition \
+ bazel build --verbose_failures --apple_crosstool_in_output_directory_name \
--ios_sdk_version=$IOS_SDK_VERSION //objclib:objclib >"$TEST_log" 2>&1 \
|| fail "Should build objc_library"
@@ -109,9 +110,9 @@ EOF
# Dec 31 1969 or Jan 1 1970 -- either is fine.
# We would use 'date' here, but the format is slightly different (Jan 1 vs.
# Jan 01).
- ar -tv bazel-out/ios_x86_64-fastbuild/bin/objclib/libobjclib.a \
+ ar -tv bazel-out/apl-ios_x86_64-fastbuild/bin/objclib/libobjclib.a \
| grep "mysrc" | grep "Dec 31" | grep "1969" \
- || ar -tv bazel-out/ios_x86_64-fastbuild/bin/objclib/libobjclib.a \
+ || ar -tv bazel-out/apl-ios_x86_64-fastbuild/bin/objclib/libobjclib.a \
| grep "mysrc" | grep "Jan 1" | grep "1970" || \
fail "Timestamp of contents of archive file should be zero"
}