aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-03-22 18:23:03 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-03-23 12:19:51 +0000
commit73f2a45d3a601b43e72c866e44f4ba3eaa782aeb (patch)
tree7a5ab2d1524f02526d22e6de0f2d3f7bd8f15779 /src/main/java/com/google/devtools/build/lib/rules/objc/Bundling.java
parenta65d0ee1f9376820f87309a3b81502ad14614583 (diff)
Introduce ReleaseBundling class to contain all application specific information required for creating a release bundle.
-- MOS_MIGRATED_REVID=117843546
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.java71
1 files changed, 64 insertions, 7 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 ec9da712c7..c9b83efdae 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
@@ -30,6 +30,7 @@ import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingR
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
@@ -63,6 +64,8 @@ final class Bundling {
private String fallbackBundleId;
private String architecture;
private DottedVersion minimumOsVersion;
+ private ImmutableSet<TargetDeviceFamily> families;
+ private String artifactPrefix;
public Builder setName(String name) {
this.name = name;
@@ -104,6 +107,15 @@ final class Bundling {
}
/**
+ * Adds the given list of artifacts representing {@code Info.plist}s that are to be merged into
+ * this bundle's {@code Info.plist}.
+ */
+ public Builder addInfoplistInputs(Iterable<Artifact> infoplists) {
+ this.infoplistInputs.addAll(infoplists);
+ return this;
+ }
+
+ /**
* Adds an artifact representing an {@code Info.plist} that contains automatic entries
* generated by xcode.
*/
@@ -137,12 +149,12 @@ final class Bundling {
this.intermediateArtifacts = intermediateArtifacts;
return this;
}
-
+
public Builder setPrimaryBundleId(String primaryId) {
this.primaryBundleId = primaryId;
return this;
}
-
+
public Builder setFallbackBundleId(String fallbackId) {
this.fallbackBundleId = fallbackId;
return this;
@@ -157,6 +169,16 @@ final class Bundling {
return this;
}
+ public Builder setTargetDeviceFamilies(ImmutableSet<TargetDeviceFamily> families) {
+ this.families = families;
+ return this;
+ }
+
+ public Builder setArtifactPrefix(String artifactPrefix) {
+ this.artifactPrefix = artifactPrefix;
+ return this;
+ }
+
private static NestedSet<Artifact> nestedBundleContentArtifacts(Iterable<Bundling> bundles) {
NestedSetBuilder<Artifact> artifacts = NestedSetBuilder.stableOrder();
for (Bundling bundle : bundles) {
@@ -259,7 +281,7 @@ final class Bundling {
public Bundling build() {
Preconditions.checkNotNull(intermediateArtifacts, "intermediateArtifacts");
-
+ Preconditions.checkNotNull(families, "families");
NestedSet<Artifact> bundleInfoplistInputs = bundleInfoplistInputs();
Optional<Artifact> bundleInfoplist = bundleInfoplist(bundleInfoplistInputs);
Optional<Artifact> actoolzipOutput = actoolzipOutput();
@@ -295,7 +317,10 @@ final class Bundling {
minimumOsVersion,
bundleInfoplistInputs,
automaticEntriesInfoplistInput,
- objcProvider.get(NESTED_BUNDLE));
+ objcProvider.get(NESTED_BUNDLE),
+ families,
+ intermediateArtifacts,
+ artifactPrefix);
}
}
@@ -320,6 +345,9 @@ final class Bundling {
private final NestedSet<Artifact> infoplistInputs;
private final NestedSet<Bundling> nestedBundlings;
private Artifact automaticEntriesInfoplistInput;
+ private final ImmutableSet<TargetDeviceFamily> families;
+ private final IntermediateArtifacts intermediateArtifacts;
+ private final String artifactPrefix;
private Bundling(
String name,
@@ -336,7 +364,10 @@ final class Bundling {
DottedVersion minimumOsVersion,
NestedSet<Artifact> infoplistInputs,
Artifact automaticEntriesInfoplistInput,
- NestedSet<Bundling> nestedBundlings) {
+ NestedSet<Bundling> nestedBundlings,
+ ImmutableSet<TargetDeviceFamily> families,
+ IntermediateArtifacts intermediateArtifacts,
+ String artifactPrefix) {
this.nestedBundlings = Preconditions.checkNotNull(nestedBundlings);
this.name = Preconditions.checkNotNull(name);
this.bundleDirFormat = Preconditions.checkNotNull(bundleDirFormat);
@@ -352,6 +383,9 @@ final class Bundling {
this.minimumOsVersion = Preconditions.checkNotNull(minimumOsVersion);
this.infoplistInputs = Preconditions.checkNotNull(infoplistInputs);
this.automaticEntriesInfoplistInput = automaticEntriesInfoplistInput;
+ this.families = Preconditions.checkNotNull(families);
+ this.intermediateArtifacts = intermediateArtifacts;
+ this.artifactPrefix = artifactPrefix;
}
/**
@@ -401,7 +435,7 @@ 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}, other than that plist that contains blaze-generated automatic entires.
@@ -428,7 +462,7 @@ final class Bundling {
}
return result.build();
}
-
+
/**
* Returns {@code true} if this bundle requires merging of its {@link #getBundleInfoplist() info
* plist}.
@@ -505,4 +539,27 @@ final class Bundling {
public DottedVersion getMinimumOsVersion() {
return minimumOsVersion;
}
+
+ /**
+ * Returns the list of {@link TargetDeviceFamily} values this bundle is targeting.
+ * If empty, the default values specified by "families" attribute will be used.
+ */
+ public ImmutableSet<TargetDeviceFamily> getTargetDeviceFamilies() {
+ return families;
+ }
+
+ /**
+ * Returns {@link IntermediateArtifacts} required to create this bundle.
+ */
+ public IntermediateArtifacts getIntermediateArtifacts() {
+ return intermediateArtifacts;
+ }
+
+ /**
+ * Returns the prefix to be added to all generated artifact names, can be null. This is useful
+ * to disambiguate artifacts for multiple bundles created with different names withing same rule.
+ */
+ public String getArtifactPrefix() {
+ return artifactPrefix;
+ }
}