diff options
author | Googler <noreply@google.com> | 2015-12-16 16:35:56 +0000 |
---|---|---|
committer | Nathan Harmata <nharmata@google.com> | 2015-12-16 20:24:28 +0000 |
commit | f5c3a974a7c9568cb071c56800899de6d8650c5d (patch) | |
tree | 7cb45dd7a5e510e09336d61c41a3642b9a76a9d4 /src/objc_tools | |
parent | 76d94b1c2f3a92544f9c9de536b56b53a242c21a (diff) |
plmerge optionally consumes an executable name. This is necessary to ensure that Blaze can assign a default executable name, for when CFBundleExecutable is not given.
--
MOS_MIGRATED_REVID=110363400
Diffstat (limited to 'src/objc_tools')
3 files changed, 34 insertions, 7 deletions
diff --git a/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java b/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java index 6461fadc31..c9714b637b 100644 --- a/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java +++ b/src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java @@ -152,7 +152,8 @@ public final class BundleMerging { control.getSdkVersion(), control.getMinimumOsVersion()), substitutionMap.build(), - new KeysToRemoveIfEmptyString("CFBundleIconFile", "NSPrincipalClass")); + new KeysToRemoveIfEmptyString("CFBundleIconFile", "NSPrincipalClass"), + /*executableName*/ null); if (control.hasExecutableName()) { plistMerging.setExecutableName(control.getExecutableName()); } diff --git a/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/MergingArguments.java b/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/MergingArguments.java index 9f92f65771..61d23de749 100644 --- a/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/MergingArguments.java +++ b/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/MergingArguments.java @@ -37,6 +37,7 @@ class MergingArguments { private final Map<String, String> variableSubstitutions; private final String primaryBundleId; private final String fallbackBundleId; + private final String executableName; /** * Build MergingArguments from a plmerge protobuf. @@ -58,6 +59,11 @@ class MergingArguments { variableSubstitutions = control.getVariableSubstitutionMap(); primaryBundleId = control.getPrimaryBundleId(); fallbackBundleId = control.getFallbackBundleId(); + if (control.hasExecutableName()) { + executableName = control.getExecutableName(); + } else { + executableName = null; + } } /** @@ -75,6 +81,7 @@ class MergingArguments { variableSubstitutions = ImmutableMap.<String, String>of(); primaryBundleId = options.primaryBundleId; fallbackBundleId = options.fallbackBundleId; + executableName = null; } /** @@ -130,4 +137,12 @@ class MergingArguments { public Map<String, String> getVariableSubstitutions() { return variableSubstitutions; } + + /** + * Returns the name of the executable for the bundle the merged plist is intended for, or null + * if no such executable exists. + */ + public String getExecutableName() { + return executableName; + } } diff --git a/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/PlistMerging.java b/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/PlistMerging.java index c7ed0b182a..6a39870910 100644 --- a/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/PlistMerging.java +++ b/src/objc_tools/plmerge/java/com/google/devtools/build/xcode/plmerge/PlistMerging.java @@ -187,24 +187,27 @@ public class PlistMerging extends Value<PlistMerging> { mergingArguments.getSourceFilePaths(), mergingArguments.getImmutableSourceFilePaths(), mergingArguments.getVariableSubstitutions(), - keysToRemoveIfEmptyString); + keysToRemoveIfEmptyString, + mergingArguments.getExecutableName()); } /** - * Generates a Plistmerging combining values from sourceFiles and immutableSourceFiles, and + * Generates a Plistmerging combining values from sourceFiles and immutableSourceFiles, and * modifying them based on subsitutions and keysToRemoveIfEmptyString. */ public static PlistMerging from( List<Path> sourceFiles, List<Path> immutableSourceFiles, Map<String, String> substitutions, - KeysToRemoveIfEmptyString keysToRemoveIfEmptyString) + KeysToRemoveIfEmptyString keysToRemoveIfEmptyString, + String executableName) throws IOException { return from( sourceFiles, PlistMerging.merge(immutableSourceFiles), substitutions, - keysToRemoveIfEmptyString); + keysToRemoveIfEmptyString, + executableName); } /** @@ -219,7 +222,8 @@ public class PlistMerging extends Value<PlistMerging> { List<Path> sourceFiles, Map<String, NSObject> immutableEntries, Map<String, String> substitutions, - KeysToRemoveIfEmptyString keysToRemoveIfEmptyString) + KeysToRemoveIfEmptyString keysToRemoveIfEmptyString, + String executableName) throws IOException { NSDictionary merged = PlistMerging.merge(sourceFiles); @@ -273,7 +277,14 @@ public class PlistMerging extends Value<PlistMerging> { } } } - return new PlistMerging(merged); + + PlistMerging result = new PlistMerging(merged); + + if (executableName != null) { + result.setExecutableName(executableName); + } + + return result; } private static String substituteEnvironmentVariable( |