aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java63
1 files changed, 48 insertions, 15 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 7fd7664d5c..da4843444f 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
@@ -56,7 +56,8 @@ final class Bundling {
private String bundleDirFormat;
private ImmutableList.Builder<BundleableFile> bundleFilesBuilder = ImmutableList.builder();
private ObjcProvider objcProvider;
- private NestedSetBuilder<Artifact> infoplists = NestedSetBuilder.stableOrder();
+ private NestedSetBuilder<Artifact> infoplistInputs = NestedSetBuilder.stableOrder();
+ private Artifact automaticEntriesInfoplistInput;
private IntermediateArtifacts intermediateArtifacts;
private String primaryBundleId;
private String fallbackBundleId;
@@ -94,15 +95,24 @@ final class Bundling {
/**
* Adds an artifact representing an {@code Info.plist} as an input to this bundle's
- * {@code Info.plist} (which is merged from any such added plists plus some additional
- * information).
+ * {@code Info.plist} (which is merged from any such added plists plus the generated
+ * automatic entries plist).
*/
public Builder addInfoplistInput(Artifact infoplist) {
- this.infoplists.add(infoplist);
+ this.infoplistInputs.add(infoplist);
return this;
}
/**
+ * Adds an artifact representing an {@code Info.plist} that contains automatic entries
+ * generated by xcode.
+ */
+ public Builder setAutomaticEntriesInfoplistInput(Artifact automaticEntriesInfoplist) {
+ this.automaticEntriesInfoplistInput = automaticEntriesInfoplist;
+ return this;
+ }
+
+ /**
* 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).
@@ -112,12 +122,12 @@ final class Bundling {
OptionsProvider optionsProvider = ruleContext
.getPrerequisite("options", Mode.TARGET, OptionsProvider.class);
if (optionsProvider != null) {
- infoplists.addAll(optionsProvider.getInfoplists());
+ infoplistInputs.addAll(optionsProvider.getInfoplists());
}
}
Artifact infoplist = ruleContext.getPrerequisiteArtifact("infoplist", Mode.TARGET);
if (infoplist != null) {
- infoplists.add(infoplist);
+ infoplistInputs.add(infoplist);
}
return this;
}
@@ -179,9 +189,9 @@ final class Bundling {
private NestedSet<Artifact> bundleInfoplistInputs() {
if (objcProvider.hasAssetCatalogs()) {
- infoplists.add(intermediateArtifacts.actoolPartialInfoplist());
+ infoplistInputs.add(intermediateArtifacts.actoolPartialInfoplist());
}
- return infoplists.build();
+ return infoplistInputs.build();
}
private Optional<Artifact> bundleInfoplist(NestedSet<Artifact> bundleInfoplistInputs) {
@@ -283,6 +293,7 @@ final class Bundling {
architecture,
minimumOsVersion,
bundleInfoplistInputs,
+ automaticEntriesInfoplistInput,
objcProvider.get(NESTED_BUNDLE));
}
}
@@ -305,8 +316,9 @@ final class Bundling {
private final String primaryBundleId;
private final String fallbackBundleId;
private final DottedVersion minimumOsVersion;
- private final NestedSet<Artifact> bundleInfoplistInputs;
+ private final NestedSet<Artifact> infoplistInputs;
private final NestedSet<Bundling> nestedBundlings;
+ private Artifact automaticEntriesInfoplistInput;
private Bundling(
String name,
@@ -321,7 +333,8 @@ final class Bundling {
String fallbackBundleId,
String architecture,
DottedVersion minimumOsVersion,
- NestedSet<Artifact> bundleInfoplistInputs,
+ NestedSet<Artifact> infoplistInputs,
+ Artifact automaticEntriesInfoplistInput,
NestedSet<Bundling> nestedBundlings) {
this.nestedBundlings = Preconditions.checkNotNull(nestedBundlings);
this.name = Preconditions.checkNotNull(name);
@@ -336,7 +349,8 @@ final class Bundling {
this.primaryBundleId = primaryBundleId;
this.architecture = Preconditions.checkNotNull(architecture);
this.minimumOsVersion = Preconditions.checkNotNull(minimumOsVersion);
- this.bundleInfoplistInputs = Preconditions.checkNotNull(bundleInfoplistInputs);
+ this.infoplistInputs = Preconditions.checkNotNull(infoplistInputs);
+ this.automaticEntriesInfoplistInput = automaticEntriesInfoplistInput;
}
/**
@@ -386,21 +400,40 @@ final class Bundling {
public Optional<Artifact> getBundleInfoplist() {
return bundleInfoplist;
}
-
+
/**
* Returns all info plists that need to be merged into this bundle's {@link #getBundleInfoplist()
- * info plist}.
+ * info plist}, other than that plist that contains blaze-generated automatic entires.
*/
public NestedSet<Artifact> getBundleInfoplistInputs() {
- return bundleInfoplistInputs;
+ return infoplistInputs;
+ }
+
+ /**
+ * Returns an artifact representing a plist containing automatic entries generated by bazel.
+ */
+ public Artifact getAutomaticInfoPlist() {
+ return automaticEntriesInfoplistInput;
}
/**
+ * Returns all artifacts that are required as input to the merging of the final plist.
+ */
+ public NestedSet<Artifact> getMergingContentArtifacts() {
+ NestedSetBuilder<Artifact> result = NestedSetBuilder.stableOrder();
+ result.addTransitive(infoplistInputs);
+ if (automaticEntriesInfoplistInput != null) {
+ result.add(automaticEntriesInfoplistInput);
+ }
+ return result.build();
+ }
+
+ /**
* Returns {@code true} if this bundle requires merging of its {@link #getBundleInfoplist() info
* plist}.
*/
public boolean needsToMergeInfoplist() {
- return needsToMerge(bundleInfoplistInputs, primaryBundleId, fallbackBundleId);
+ return needsToMerge(infoplistInputs, primaryBundleId, fallbackBundleId);
}
/**