Skip to content

Commit

Permalink
Avoid setting CFBundleExecutable on objc_bundle_library plists
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=130971534
  • Loading branch information
c-parsons authored and philwo committed Aug 23, 2016
1 parent bdbaedf commit 63ee240
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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;
Expand All @@ -49,6 +50,7 @@
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.
Expand Down Expand Up @@ -77,12 +79,19 @@ static final class Builder {
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()}.
Expand Down Expand Up @@ -359,6 +368,7 @@ public Bundling build() {

return new Bundling(
name,
executableName,
bundleDirFormat,
combinedArchitectureBinary,
bundleFiles,
Expand Down Expand Up @@ -387,6 +397,7 @@ private static boolean needsToMerge(
}

private final String name;
@Nullable private final String executableName;
private final String architecture;
private final String bundleDirFormat;
private final Optional<Artifact> combinedArchitectureBinary;
Expand All @@ -408,6 +419,7 @@ private static boolean needsToMerge(

private Bundling(
String name,
String executableName,
String bundleDirFormat,
Optional<Artifact> combinedArchitectureBinary,
ImmutableList<BundleableFile> bundleFiles,
Expand All @@ -428,6 +440,7 @@ private 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);
Expand Down Expand Up @@ -463,6 +476,11 @@ public String getBundleDir() {
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
Expand Down Expand Up @@ -571,7 +589,7 @@ public NestedSet<Artifact> getRootMergeZips() {
*/
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
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;

/**
Expand Down Expand Up @@ -65,7 +63,7 @@ static PlMergeControlBytes fromBundling(Bundling bundling, Artifact mergedPlist)
bundling.getPrimaryBundleId(),
bundling.getFallbackBundleId(),
bundling.variableSubstitutions(),
bundling.getName(),
bundling.getExecutableName(),
mergedPlist,
OutputFormat.BINARY);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ private Bundling bundling(
Bundling.Builder bundling =
new Builder()
.setName(bundleName)
.setExecutableName(bundleName)
// Architecture that determines which nested bundles are kept.
.setArchitecture(appleConfiguration.getDependencySingleArchitecture())
.setBundleDirFormat(bundleDirFormat)
Expand Down

0 comments on commit 63ee240

Please sign in to comment.