aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc_tools/bundlemerge
diff options
context:
space:
mode:
authorGravatar Dave MacLachlan <dmaclach@google.com>2016-02-29 00:29:58 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-02-29 17:39:50 +0000
commitdb7a8163e47bd66cd0817981dde3ab215aa51b7b (patch)
treead6187dfbadcff0498db79385c15f3aedc398006 /src/objc_tools/bundlemerge
parent9701a2817a7c81103c8d69ff7b753d1ceb17347c (diff)
Simplify plmerge and bundlemerge by removing deprecated functionality.
RELNOTES: -- MOS_MIGRATED_REVID=115804885
Diffstat (limited to 'src/objc_tools/bundlemerge')
-rw-r--r--src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java68
1 files changed, 2 insertions, 66 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 c9714b637b..c4ac90dab9 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
@@ -20,14 +20,10 @@ import static com.google.devtools.build.singlejar.ZipCombiner.OutputMode.FORCE_D
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.singlejar.ZipCombiner;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.BundleFile;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.Control;
import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.MergeZip;
-import com.google.devtools.build.xcode.bundlemerge.proto.BundleMergeProtos.VariableSubstitution;
-import com.google.devtools.build.xcode.common.Platform;
-import com.google.devtools.build.xcode.plmerge.KeysToRemoveIfEmptyString;
import com.google.devtools.build.xcode.plmerge.PlistMerging;
import com.google.devtools.build.xcode.zip.ZipFiles;
import com.google.devtools.build.xcode.zip.ZipInputEntry;
@@ -87,25 +83,6 @@ public final class BundleMerging {
private static final String INFOPLIST_FILENAME = "Info.plist";
private static final String PKGINFO_FILENAME = "PkgInfo";
- @VisibleForTesting
- static final String BOTH_ARGS_ERR =
- "Only one of source_plist_file and bundle_info_plist_file may be specified";
-
- /**
- * A hack needed briefly to maintain backwards compatibility during rename of {@link Platform}
- * enums. Except for backwards-compatible names, falls back to usage of {@link Platform#valueOf}.
- */
- // TODO(bazel-team): Remove this hack.
- private static Platform platformFromName(String platformName) {
- if ("SIMULATOR".equals(platformName)) {
- return Platform.IOS_SIMULATOR;
- } else if ("DEVICE".equals(platformName)) {
- return Platform.IOS_DEVICE;
- } else {
- return Platform.valueOf(platformName);
- }
- }
-
/**
* Adds merge artifacts from the given {@code control} into builders that collect merge zips and
* individual files. {@code bundleRoot} is prepended to each path, except the paths in the merge
@@ -118,50 +95,14 @@ public final class BundleMerging {
Path tempMergedPlist = Files.createTempFile(tempDir, null, INFOPLIST_FILENAME);
Path tempPkgInfo = Files.createTempFile(tempDir, null, PKGINFO_FILENAME);
-
- if (control.hasBundleInfoPlistFile() && !control.getSourcePlistFileList().isEmpty()) {
- throw new IllegalArgumentException(BOTH_ARGS_ERR);
- }
if (control.hasBundleInfoPlistFile()) {
Path bundleInfoPlist = fileSystem.getPath(control.getBundleInfoPlistFile());
-
new PlistMerging(PlistMerging.readPlistFile(bundleInfoPlist))
.setBundleIdentifier(
control.hasPrimaryBundleIdentifier() ? control.getPrimaryBundleIdentifier() : null,
control.hasFallbackBundleIdentifier() ? control.getFallbackBundleIdentifier() : null)
- .write(tempMergedPlist, tempPkgInfo);
- } else {
- // TODO (cpeyser): Remove this branch once blaze uses bundle_info_plist_file
-
- // Generate the Info.plist and PkgInfo files to include in the app bundle.
- ImmutableList.Builder<Path> sourcePlistFilesBuilder = new ImmutableList.Builder<>();
- for (String sourcePlist : control.getSourcePlistFileList()) {
- sourcePlistFilesBuilder.add(fileSystem.getPath(sourcePlist));
- }
- ImmutableList<Path> sourcePlistFiles = sourcePlistFilesBuilder.build();
- ImmutableMap.Builder<String, String> substitutionMap = ImmutableMap.builder();
- for (VariableSubstitution substitution : control.getVariableSubstitutionList()) {
- substitutionMap.put(substitution.getName(), substitution.getValue());
- }
- PlistMerging plistMerging =
- PlistMerging.from(
- sourcePlistFiles,
- PlistMerging.automaticEntries(
- control.getTargetDeviceFamilyList(),
- platformFromName(control.getPlatform()),
- control.getSdkVersion(),
- control.getMinimumOsVersion()),
- substitutionMap.build(),
- new KeysToRemoveIfEmptyString("CFBundleIconFile", "NSPrincipalClass"),
- /*executableName*/ null);
- if (control.hasExecutableName()) {
- plistMerging.setExecutableName(control.getExecutableName());
- }
-
- plistMerging.setBundleIdentifier(
- control.hasPrimaryBundleIdentifier() ? control.getPrimaryBundleIdentifier() : null,
- control.hasFallbackBundleIdentifier() ? control.getFallbackBundleIdentifier() : null)
- .write(tempMergedPlist, tempPkgInfo);
+ .writePlist(tempMergedPlist)
+ .writePkgInfo(tempPkgInfo);
}
bundleRoot = joinPath(bundleRoot, control.getBundleRoot());
@@ -183,11 +124,6 @@ public final class BundleMerging {
externalFileAttribute));
}
- for (String mergeZip : control.getMergeWithoutNamePrefixZipList()) {
- mergeZipsBuilder.add(MergeZip.newBuilder()
- .setSourcePath(mergeZip)
- .build());
- }
mergeZipsBuilder.addAll(control.getMergeZipList());
for (Control nestedControl : control.getNestedBundleList()) {