aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Cal Peyser <cpeyser@google.com>2016-01-08 18:15:28 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-01-11 09:41:57 +0000
commit90a8d6c04f35a5f2ea1417bc9cf7517c400ecfc8 (patch)
treefb4f17eb1c713d4c53508b5ff2435e2a25c6363a /src
parente933d5edbcd9d46d3a636c1265250e9c45861804 (diff)
Enable objc targets that produce bundles to specify multiple plist files with the "infoplists" attribute. The plists are merged to produce the bundle's Info.plist.
This attribute will live alongside the current "infoplist" attribute until the next Blaze release. -- MOS_MIGRATED_REVID=111705709
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java13
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/ObjcRuleClasses.java90
2 files changed, 67 insertions, 36 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java b/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
index da4843444f..f7ea2729db 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
@@ -113,9 +113,9 @@ final class Bundling {
}
/**
- * Adds any info plists specified in the given rule's {@code infoplist} attribute as well as
- * from its {@code options} as inputs to this bundle's {@code Info.plist} (which is merged from
- * any such added plists plus some additional information).
+ * Adds any info plists specified in the given rule's {@code infoplist} or {@code infoplists}
+ * attribute as well as from its {@code options} as inputs to this bundle's {@code Info.plist}
+ * (which is merged from any such added plists plus some additional information).
*/
public Builder addInfoplistInputFromRule(RuleContext ruleContext) {
if (ruleContext.attributes().has("options", BuildType.LABEL)) {
@@ -129,6 +129,13 @@ final class Bundling {
if (infoplist != null) {
infoplistInputs.add(infoplist);
}
+
+ Iterable<Artifact> infoplists =
+ ruleContext.getPrerequisiteArtifacts("infoplists", Mode.TARGET).list();
+ if (infoplists != null) {
+ infoplistInputs.addAll(infoplists);
+ }
+
return this;
}
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 2faaf1f2ac..66d4e76c24 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
@@ -811,40 +811,64 @@ public class ObjcRuleClasses {
@Override
public RuleClass build(Builder builder, RuleDefinitionEnvironment env) {
return builder
- /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(infoplist) -->
- The infoplist file. This corresponds to <i>appname</i>-Info.plist in Xcode projects.
+ /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(infoplist)[DEPRECATED] -->
+ The infoplist file. This corresponds to <i>appname</i>-Info.plist in Xcode projects.
+ ${SYNOPSIS}
+ Blaze will perform variable substitution on the plist file for the following values:
+ <ul>
+ <li><code>${EXECUTABLE_NAME}</code>: The name of the executable generated and included
+ in the bundle by blaze, which can be used as the value for
+ <code>CFBundleExecutable</code> within the plist.
+ <li><code>${BUNDLE_NAME}</code>: This target's name and bundle suffix (.bundle or .app)
+ in the form<code><var>name</var></code>.<code>suffix</code>.
+ <li><code>${PRODUCT_NAME}</code>: This target's name.
+ </ul>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr("infoplist", LABEL).allowedFileTypes(PLIST_TYPE))
+ /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(infoplists) -->
+ Infoplist files to be merged. The merged output corresponds to <i>appname</i>-Info.plist
+ in Xcode projects. Duplicate keys between infoplist files will cause an error if
+ and only if the values conflict. If both <code>infoplist</code> and
+ <code>infoplists</code> are specified, the files defined in both attributes will be used.
+ ${SYNOPSIS}
+ Blaze will perform variable substitution on the plist files for the following values:
+ <ul>
+ <li><code>${EXECUTABLE_NAME}</code>: The name of the executable generated and included
+ in the bundle by blaze, which can be used as the value for
+ <code>CFBundleExecutable</code> within the plist.
+ <li><code>${BUNDLE_NAME}</code>: This target's name and bundle suffix (.bundle or .app)
+ in the form<code><var>name</var></code>.<code>suffix</code>.
+ <li><code>${PRODUCT_NAME}</code>: This target's name.
+ </ul>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(attr("infoplists", BuildType.LABEL_LIST).allowedFileTypes(PLIST_TYPE))
+ /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(families) -->
+ The device families to which this bundle or binary is targeted.
${SYNOPSIS}
- Blaze will perform variable substitution on the plist file for the following values:
- <ul>
- <li><code>${EXECUTABLE_NAME}</code>: The name of the executable generated and included
- in the bundle by blaze, which can be used as the value for
- <code>CFBundleExecutable</code> within the plist.
- <li><code>${BUNDLE_NAME}</code>: This target's name and bundle suffix (.bundle or .app)
- in the form<code><var>name</var></code>.<code>suffix</code>.
- <li><code>${PRODUCT_NAME}</code>: This target's name.
- </ul>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("infoplist", LABEL)
- .allowedFileTypes(PLIST_TYPE))
- /* <!-- #BLAZE_RULE($objc_bundling_rule).ATTRIBUTE(families) -->
- The device families to which this bundle or binary is targeted.
- ${SYNOPSIS}
-
- This is known as the <code>TARGETED_DEVICE_FAMILY</code> build setting
- in Xcode project files. It is a list of one or more of the strings
- <code>"iphone"</code> and <code>"ipad"</code>.
-
- <p>By default this is set to <code>"iphone"</code>, if explicitly specified may not be
- empty.</p>
- <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
- .add(attr("families", STRING_LIST)
- .value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
- .add(attr("$momcwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:momcwrapper")))
- .add(attr("$swiftstdlibtoolwrapper", LABEL).cfg(HOST).exec()
- .value(env.getLabel(
- Constants.TOOLS_REPOSITORY + "//tools/objc:swiftstdlibtoolwrapper")))
- .build();
+
+ This is known as the <code>TARGETED_DEVICE_FAMILY</code> build setting
+ in Xcode project files. It is a list of one or more of the strings
+ <code>"iphone"</code> and <code>"ipad"</code>.
+
+ <p>By default this is set to <code>"iphone"</code>, if explicitly specified may not be
+ empty.</p>
+ <!-- #END_BLAZE_RULE.ATTRIBUTE -->*/
+ .add(
+ attr("families", STRING_LIST)
+ .value(ImmutableList.of(TargetDeviceFamily.IPHONE.getNameInRule())))
+ .add(
+ attr("$momcwrapper", LABEL)
+ .cfg(HOST)
+ .exec()
+ .value(env.getLabel(Constants.TOOLS_REPOSITORY + "//tools/objc:momcwrapper")))
+ .add(
+ attr("$swiftstdlibtoolwrapper", LABEL)
+ .cfg(HOST)
+ .exec()
+ .value(
+ env.getLabel(
+ Constants.TOOLS_REPOSITORY + "//tools/objc:swiftstdlibtoolwrapper")))
+ .build();
}
@Override
public Metadata getMetadata() {