diff options
Diffstat (limited to 'src/main')
3 files changed, 21 insertions, 4 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 3bbb1eb901..13bc0d97dd 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 @@ -32,6 +32,7 @@ import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingR import static com.google.devtools.build.lib.rules.objc.ObjcRuleClasses.BundlingRule.INFOPLIST_ATTR; import com.google.common.base.Optional; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -49,6 +50,7 @@ import com.google.devtools.build.lib.vfs.PathFragment; import java.util.HashSet; import java.util.Map; import java.util.Set; +import javax.annotation.Nullable; /** * Contains information regarding the creation of an iOS bundle. @@ -77,12 +79,19 @@ final class Bundling { private DottedVersion minimumOsVersion; private ImmutableSet<TargetDeviceFamily> families; private String artifactPrefix; + @Nullable private String executableName; public Builder setName(String name) { this.name = name; return this; } + /** Sets the name of the bundle's executable. */ + public Builder setExecutableName(String executableName) { + this.executableName = executableName; + return this; + } + /** * Sets the CPU architecture this bundling was constructed for. Legal value are any that may be * set on {@link AppleConfiguration#getIosCpu()}. @@ -359,6 +368,7 @@ final class Bundling { return new Bundling( name, + executableName, bundleDirFormat, combinedArchitectureBinary, bundleFiles, @@ -387,6 +397,7 @@ final class Bundling { } private final String name; + @Nullable private final String executableName; private final String architecture; private final String bundleDirFormat; private final Optional<Artifact> combinedArchitectureBinary; @@ -408,6 +419,7 @@ final class Bundling { private Bundling( String name, + String executableName, String bundleDirFormat, Optional<Artifact> combinedArchitectureBinary, ImmutableList<BundleableFile> bundleFiles, @@ -428,6 +440,7 @@ final class Bundling { String artifactPrefix) { this.nestedBundlings = Preconditions.checkNotNull(nestedBundlings); this.name = Preconditions.checkNotNull(name); + this.executableName = executableName; this.bundleDirFormat = Preconditions.checkNotNull(bundleDirFormat); this.combinedArchitectureBinary = Preconditions.checkNotNull(combinedArchitectureBinary); this.bundleFiles = Preconditions.checkNotNull(bundleFiles); @@ -463,6 +476,11 @@ final class Bundling { public String getName() { return name; } + + /** The name of the bundle's executable, or null if the bundle has no executable. */ + @Nullable public String getExecutableName() { + return executableName; + } /** * An {@link Optional} with the linked binary artifact, or {@link Optional#absent()} if it is @@ -571,7 +589,7 @@ final class Bundling { */ public Map<String, String> variableSubstitutions() { return ImmutableMap.of( - "EXECUTABLE_NAME", name, + "EXECUTABLE_NAME", Strings.nullToEmpty(executableName), "BUNDLE_NAME", new PathFragment(getBundleDir()).getBaseName(), "PRODUCT_NAME", name); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/PlMergeControlBytes.java b/src/main/java/com/google/devtools/build/lib/rules/objc/PlMergeControlBytes.java index fc0450582c..80eecdf3db 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/PlMergeControlBytes.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/PlMergeControlBytes.java @@ -23,11 +23,9 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import com.google.devtools.build.xcode.plmerge.proto.PlMergeProtos; import com.google.devtools.build.xcode.plmerge.proto.PlMergeProtos.Control; - import java.io.IOException; import java.io.InputStream; import java.util.Map; - import javax.annotation.Nullable; /** @@ -65,7 +63,7 @@ public final class PlMergeControlBytes extends ByteSource { bundling.getPrimaryBundleId(), bundling.getFallbackBundleId(), bundling.variableSubstitutions(), - bundling.getName(), + bundling.getExecutableName(), mergedPlist, OutputFormat.BINARY); } 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 c0e82edaa2..6237e7d348 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 @@ -768,6 +768,7 @@ public final class ReleaseBundlingSupport { Bundling.Builder bundling = new Builder() .setName(bundleName) + .setExecutableName(bundleName) // Architecture that determines which nested bundles are kept. .setArchitecture(appleConfiguration.getDependencySingleArchitecture()) .setBundleDirFormat(bundleDirFormat) |