aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-07-25 08:47:23 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-07-25 13:17:42 +0200
commitf929b1a174b535ad6e42bf908879996b77060c31 (patch)
treec49f603c30534b23bf8dc243a9f9781abff317ff /src/test/java
parentef9fe8f3a291e9be3ba2d87ca0310178d0990b84 (diff)
Add a command line option to make the minimum_os_version attribute mandatory on Apple rules.
RELNOTES: None. PiperOrigin-RevId: 163035922
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java21
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java20
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/objc/AppleStubBinaryTest.java18
3 files changed, 59 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
index 89d3517442..a359149170 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleBinaryTest.java
@@ -75,6 +75,27 @@ public class AppleBinaryTest extends ObjcRuleTestCase {
ImmutableSet.of(COCOA_FRAMEWORK_FLAG);
@Test
+ public void testMandatoryMinimumOsVersionUnset() throws Exception {
+ RULE_TYPE.scratchTarget(scratch,
+ "srcs", "['a.m']",
+ "platform_type", "'watchos'");
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ reporter.removeHandler(failFastHandler);
+ getConfiguredTarget("//x:x");
+ assertContainsEvent("must be explicitly specified");
+ }
+
+ @Test
+ public void testMandatoryMinimumOsVersionSet() throws Exception {
+ RULE_TYPE.scratchTarget(scratch,
+ "minimum_os_version", "'8.0'",
+ "srcs", "['a.m']",
+ "platform_type", "'watchos'");
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ getConfiguredTarget("//x:x");
+ }
+
+ @Test
public void testLipoActionEnv() throws Exception {
RULE_TYPE.scratchTarget(scratch,
"srcs", "['a.m']",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
index 19e2013ede..6d8a4125ab 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStaticLibraryTest.java
@@ -56,6 +56,26 @@ public class AppleStaticLibraryTest extends ObjcRuleTestCase {
}
};
+ @Test
+ public void testMandatoryMinimumOsVersionUnset() throws Exception {
+ RULE_TYPE.scratchTarget(scratch,
+ "srcs", "['a.m']",
+ "platform_type", "'watchos'");
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ reporter.removeHandler(failFastHandler);
+ getConfiguredTarget("//x:x");
+ assertContainsEvent("must be explicitly specified");
+ }
+
+ @Test
+ public void testMandatoryMinimumOsVersionSet() throws Exception {
+ RULE_TYPE.scratchTarget(scratch,
+ "minimum_os_version", "'8.0'",
+ "srcs", "['a.m']",
+ "platform_type", "'watchos'");
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ getConfiguredTarget("//x:x");
+ }
@Test
public void testUnknownPlatformType() throws Exception {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStubBinaryTest.java b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStubBinaryTest.java
index 695a218a7b..c6f58ef67e 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStubBinaryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/objc/AppleStubBinaryTest.java
@@ -46,6 +46,24 @@ public class AppleStubBinaryTest extends ObjcRuleTestCase {
};
@Test
+ public void testMandatoryMinimumOsVersionUnset() throws Exception {
+ RULE_TYPE.scratchTarget(scratch);
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ reporter.removeHandler(failFastHandler);
+ getConfiguredTarget("//x:x");
+ assertContainsEvent("must be explicitly specified");
+ }
+
+ @Test
+ public void testMandatoryMinimumOsVersionSet() throws Exception {
+ RULE_TYPE.scratchTarget(scratch,
+ "xcenv_based_path", "'$(SDKROOT)/Foo'",
+ "minimum_os_version", "'8.0'");
+ useConfiguration("--experimental_apple_mandatory_minimum_version");
+ getConfiguredTarget("//x:x");
+ }
+
+ @Test
public void testCopyActionEnv() throws Exception {
RULE_TYPE.scratchTarget(
scratch,