aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar Dave MacLachlan <dmaclach@google.com>2016-03-11 20:45:21 +0000
committerGravatar David Chen <dzc@google.com>2016-03-11 21:30:12 +0000
commitff97c3003e0280f68991417469cd04d773866b9c (patch)
tree7b2c4b05adbd2a0d8e5fdd9e0c972426266efe99 /src/main/java/com/google/devtools/build/lib/rules
parentefab03eadfca251496111429071c2acf38cf4b41 (diff)
Removes restriction on having both a launchimage and a launchstoryboard in a given application as there are cases where you want both.
-- MOS_MIGRATED_REVID=116998425
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java15
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java29
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java36
3 files changed, 18 insertions, 62 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
index abf35a1fea..16ec90aab2 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java
@@ -14,6 +14,7 @@
package com.google.devtools.build.lib.rules.objc;
+import static com.google.devtools.build.lib.packages.BuildType.LABEL;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.ASSET_CATALOG;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.BREAKPAD_FILE;
import static com.google.devtools.build.lib.rules.objc.ObjcProvider.BUNDLE_FILE;
@@ -555,7 +556,7 @@ public final class ObjcCommon {
.addAll(STORYBOARD, attributes.storyboards());
}
- if (ObjcRuleClasses.useLaunchStoryboard(context)) {
+ if (useLaunchStoryboard(context)) {
Artifact launchStoryboard =
context.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
objcProvider.add(GENERAL_RESOURCE_FILE, launchStoryboard);
@@ -626,6 +627,18 @@ public final class ObjcCommon {
return new ObjcCommon(objcProvider.build(), compilationArtifacts);
}
+ /**
+ * Returns {@code true} if the given rule context has a launch storyboard set.
+ */
+ private static boolean useLaunchStoryboard(RuleContext ruleContext) {
+ if (!ruleContext.attributes().has("launch_storyboard", LABEL)) {
+ return false;
+ }
+ Artifact launchStoryboard =
+ ruleContext.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
+ return launchStoryboard != null;
+ }
+
}
static final FileType BUNDLE_CONTAINER_TYPE = FileType.of(".bundle");
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
index 65e1f9c1d8..d307c5bc05 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java
@@ -52,7 +52,6 @@ import com.google.devtools.build.lib.packages.RuleClass.Builder.RuleClassType;
import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
import com.google.devtools.build.lib.rules.apple.AppleToolchain;
import com.google.devtools.build.lib.rules.apple.AppleToolchain.RequiresXcodeConfigRule;
-import com.google.devtools.build.lib.rules.apple.DottedVersion;
import com.google.devtools.build.lib.rules.apple.Platform;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.FileType;
@@ -70,9 +69,6 @@ public class ObjcRuleClasses {
static final String LIPO = "lipo";
static final String STRIP = "strip";
- private static final DottedVersion MIN_LAUNCH_STORYBOARD_OS_VERSION =
- DottedVersion.fromString("8.0");
-
private ObjcRuleClasses() {
throw new UnsupportedOperationException("static-only");
}
@@ -192,31 +188,6 @@ public class ObjcRuleClasses {
}
/**
- * Returns {@code true} if the given rule context has a launch storyboard set and the given
- * {@code iosMinimumOs} supports launch storyboards.
- */
- static boolean useLaunchStoryboard(RuleContext ruleContext, DottedVersion iosMinimumOs) {
- if (!ruleContext.attributes().has("launch_storyboard", LABEL)) {
- return false;
- }
- Artifact launchStoryboard =
- ruleContext.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
- return launchStoryboard != null
- && iosMinimumOs.compareTo(MIN_LAUNCH_STORYBOARD_OS_VERSION) >= 0;
- }
-
- /**
- * Returns {@code true} if the given rule context has a launch storyboard set and its
- * configuration (--ios_minimum_os) supports launch storyboards.
- */
- static boolean useLaunchStoryboard(RuleContext ruleContext) {
- // We check launch_storyboard before retrieving the minimum os from the configuration,
- // allowing this to be invoked even in contexts which do not depend on ObjcConfiguration.
- return (ruleContext.attributes().has("launch_storyboard", LABEL)
- && useLaunchStoryboard(ruleContext, objcConfiguration(ruleContext).getMinimumOs()));
- }
-
- /**
* Attributes for {@code objc_*} rules that have compiler options.
*/
public static class CoptsRule implements RuleDefinition {
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
index 64109672e5..795b967369 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java
@@ -226,8 +226,6 @@ public final class ReleaseBundlingSupport {
ruleContext.attributeError("families", INVALID_FAMILIES_ERROR);
}
- validateLaunchScreen();
-
AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
if (attributes.provisioningProfile() == null
&& appleConfiguration.getBundlingPlatform() != Platform.IOS_SIMULATOR) {
@@ -237,30 +235,6 @@ public final class ReleaseBundlingSupport {
return this;
}
- private void validateLaunchScreen() {
- if (ruleContext.attributes().isAttributeValueExplicitlySpecified("launch_storyboard")) {
- DottedVersion minimumOs = bundling.getMinimumOsVersion();
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
- if (ruleContext.attributes().isAttributeValueExplicitlySpecified("launch_image")) {
- ruleContext.attributeWarning(
- "launch_image",
- String.format(
- "launch_image was specified but since --ios_minimum_os=%s (>=8.0), the also "
- + "specified launch_storyboard will be used instead",
- minimumOs));
- }
- } else {
- if (!ruleContext.attributes().isAttributeValueExplicitlySpecified("launch_image")) {
- ruleContext.attributeWarning(
- "launch_storyboard",
- String.format(
- "launch_storyboard was specified but since --ios_minimum_os=%s (<8.0) and no "
- + "launch_image was specified instead it will be ignored",
- minimumOs));
- }
- }
- }
- }
/**
* Validates that resources defined in this rule and its dependencies and written to this bundle
@@ -293,7 +267,7 @@ public final class ReleaseBundlingSupport {
registerEnvironmentPlistAction();
registerAutomaticPlistAction();
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
+ if (attributes.launchStoryboard() != null) {
registerLaunchStoryboardPlistAction();
}
@@ -624,8 +598,7 @@ public final class ReleaseBundlingSupport {
if (attributes.appIcon() != null) {
extraArgs.add("--app-icon", attributes.appIcon());
}
- if (attributes.launchImage() != null
- && !ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
+ if (attributes.launchImage() != null) {
extraArgs.add("--launch-image", attributes.launchImage());
}
return new ExtraActoolArgs(extraArgs.build());
@@ -673,7 +646,7 @@ public final class ReleaseBundlingSupport {
.setFallbackBundleId(fallbackBundleId)
.setMinimumOsVersion(minimumOsVersion);
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, minimumOsVersion)) {
+ if (attributes.launchStoryboard() != null) {
bundling.addInfoplistInput(getLaunchStoryboardPlist());
}
@@ -715,8 +688,7 @@ public final class ReleaseBundlingSupport {
.setValue(attributes.appIcon())
.build());
}
- if (attributes.launchImage() != null
- && !ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
+ if (attributes.launchImage() != null) {
buildSettings.add(XcodeprojBuildSetting.newBuilder()
.setName("ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME")
.setValue(attributes.launchImage())