aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Chris Parsons <cparsons@google.com>2016-01-29 18:52:17 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-02-01 09:45:43 +0000
commit97dbc0c7a736d6b28fb5b28f8af1f3e806b435a8 (patch)
tree36d572eca4ab0c057e978129734aac1042322528 /src
parentef7a8a56f4eebd758762e9066eb00cd9eab752d5 (diff)
Infer minimum OS for plist merging from the bundling object instead of the current rule's configuration.
The bundling object may be for a child rule which had different configuration values than in the current rule context. -- MOS_MIGRATED_REVID=113377636
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java20
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ReleaseBundlingSupport.java17
2 files changed, 24 insertions, 13 deletions
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 5286480551..99c880f8b6 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
@@ -217,18 +217,28 @@ public class ObjcRuleClasses {
}
/**
- * Returns {@code true} if the given rule context has a launch storyboard set and its
- * configuration (--ios_minimum_os) supports launch storyboards.
+ * 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) {
+ static boolean useLaunchStoryboard(RuleContext ruleContext, DottedVersion iosMinimumOs) {
if (!ruleContext.attributes().has("launch_storyboard", LABEL)) {
return false;
}
Artifact launchStoryboard =
ruleContext.getPrerequisiteArtifact("launch_storyboard", Mode.TARGET);
- DottedVersion flagMinimumOs = objcConfiguration(ruleContext).getMinimumOs();
return launchStoryboard != null
- && flagMinimumOs.compareTo(MIN_LAUNCH_STORYBOARD_OS_VERSION) >= 0;
+ && 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()));
}
/**
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 f00b6f2cd1..2f85559332 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
@@ -235,8 +235,8 @@ public final class ReleaseBundlingSupport {
private void validateLaunchScreen() {
if (ruleContext.attributes().isAttributeValueExplicitlySpecified("launch_storyboard")) {
- DottedVersion minimumOs = ObjcRuleClasses.objcConfiguration(ruleContext).getMinimumOs();
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext)) {
+ DottedVersion minimumOs = bundling.getMinimumOsVersion();
+ if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
if (ruleContext.attributes().isAttributeValueExplicitlySpecified("launch_image")) {
ruleContext.attributeWarning(
"launch_image",
@@ -301,7 +301,7 @@ public final class ReleaseBundlingSupport {
registerEnvironmentPlistAction();
registerAutomaticPlistAction();
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext)) {
+ if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
registerLaunchStoryboardPlistAction();
}
@@ -412,7 +412,6 @@ public final class ReleaseBundlingSupport {
TargetDeviceFamily.UI_DEVICE_FAMILY_VALUES.get(bundleSupport.targetDeviceFamilies());
AppleConfiguration appleConfiguration = ruleContext.getFragment(AppleConfiguration.class);
Platform platform = appleConfiguration.getBundlingPlatform();
- ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext);
NSDictionary result = new NSDictionary();
@@ -424,7 +423,7 @@ public final class ReleaseBundlingSupport {
"DTSDKName",
NSObject.wrap(platform.getLowerCaseNameInPlist() + appleConfiguration.getIosSdkVersion()));
result.put("CFBundleSupportedPlatforms", new NSArray(NSObject.wrap(platform.getNameInPlist())));
- result.put("MinimumOSVersion", NSObject.wrap(objcConfiguration.getMinimumOs().toString()));
+ result.put("MinimumOSVersion", NSObject.wrap(bundling.getMinimumOsVersion().toString()));
return result;
}
@@ -568,7 +567,8 @@ public final class ReleaseBundlingSupport {
if (attributes.appIcon() != null) {
extraArgs.add("--app-icon", attributes.appIcon());
}
- if (attributes.launchImage() != null && !ObjcRuleClasses.useLaunchStoryboard(ruleContext)) {
+ if (attributes.launchImage() != null
+ && !ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
extraArgs.add("--launch-image", attributes.launchImage());
}
return new ExtraActoolArgs(extraArgs.build());
@@ -616,7 +616,7 @@ public final class ReleaseBundlingSupport {
.setFallbackBundleId(fallbackBundleId)
.setMinimumOsVersion(minimumOsVersion);
- if (ObjcRuleClasses.useLaunchStoryboard(ruleContext)) {
+ if (ObjcRuleClasses.useLaunchStoryboard(ruleContext, minimumOsVersion)) {
bundling.addInfoplistInput(getLaunchStoryboardPlist());
}
@@ -658,7 +658,8 @@ public final class ReleaseBundlingSupport {
.setValue(attributes.appIcon())
.build());
}
- if (attributes.launchImage() != null && !ObjcRuleClasses.useLaunchStoryboard(ruleContext)) {
+ if (attributes.launchImage() != null
+ && !ObjcRuleClasses.useLaunchStoryboard(ruleContext, bundling.getMinimumOsVersion())) {
buildSettings.add(XcodeprojBuildSetting.newBuilder()
.setName("ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME")
.setValue(attributes.launchImage())