diff options
author | Dave MacLachlan <dmaclach@google.com> | 2016-03-08 18:24:54 +0000 |
---|---|---|
committer | David Chen <dzc@google.com> | 2016-03-08 22:59:14 +0000 |
commit | 4fbadd86ab96f8cb8b6f83aff14856f7eb8065e2 (patch) | |
tree | 67d26c13c82ae5ecda8a3e5040b37fb380cc961b /src/objc_tools/bundlemerge | |
parent | 8a9e9ab46ac1c644b5b3ab198d0d352416f33fe5 (diff) |
If bundlemerge was called without a bundleInfoPlistFile it would generate an empty plist file. Added test to verify this doesn't get broken in the future.
--
MOS_MIGRATED_REVID=116670228
Diffstat (limited to 'src/objc_tools/bundlemerge')
-rw-r--r-- | src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java | 23 |
1 files changed, 10 insertions, 13 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 c4ac90dab9..1fb0672573 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 @@ -92,10 +92,11 @@ public final class BundleMerging { Path tempDir, FileSystem fileSystem, Control control, String bundleRoot, ImmutableList.Builder<ZipInputEntry> packagedFilesBuilder, ImmutableList.Builder<MergeZip> mergeZipsBuilder, boolean includePkgInfo) throws IOException { - Path tempMergedPlist = Files.createTempFile(tempDir, null, INFOPLIST_FILENAME); - Path tempPkgInfo = Files.createTempFile(tempDir, null, PKGINFO_FILENAME); + bundleRoot = joinPath(bundleRoot, control.getBundleRoot()); if (control.hasBundleInfoPlistFile()) { + Path tempMergedPlist = Files.createTempFile(tempDir, null, INFOPLIST_FILENAME); + Path tempPkgInfo = Files.createTempFile(tempDir, null, PKGINFO_FILENAME); Path bundleInfoPlist = fileSystem.getPath(control.getBundleInfoPlistFile()); new PlistMerging(PlistMerging.readPlistFile(bundleInfoPlist)) .setBundleIdentifier( @@ -103,17 +104,14 @@ public final class BundleMerging { control.hasFallbackBundleIdentifier() ? control.getFallbackBundleIdentifier() : null) .writePlist(tempMergedPlist) .writePkgInfo(tempPkgInfo); - } - - bundleRoot = joinPath(bundleRoot, control.getBundleRoot()); - - // Add files to zip configuration which creates the final application bundle. - packagedFilesBuilder - .add(new ZipInputEntry(tempMergedPlist, joinPath(bundleRoot, INFOPLIST_FILENAME))); - if (includePkgInfo) { packagedFilesBuilder - .add(new ZipInputEntry(tempPkgInfo, joinPath(bundleRoot, PKGINFO_FILENAME))); + .add(new ZipInputEntry(tempMergedPlist, joinPath(bundleRoot, INFOPLIST_FILENAME))); + if (includePkgInfo) { + packagedFilesBuilder + .add(new ZipInputEntry(tempPkgInfo, joinPath(bundleRoot, PKGINFO_FILENAME))); + } } + for (BundleFile bundleFile : control.getBundleFileList()) { int externalFileAttribute = bundleFile.hasExternalFileAttribute() ? bundleFile.getExternalFileAttribute() : ZipInputEntry.DEFAULT_EXTERNAL_FILE_ATTRIBUTE; @@ -140,8 +138,7 @@ public final class BundleMerging { static BundleMerging merging(Path tempDir, FileSystem fileSystem, Control control) throws IOException { ImmutableList.Builder<MergeZip> mergeZipsBuilder = new ImmutableList.Builder<>(); - ImmutableList.Builder<ZipInputEntry> packagedFilesBuilder = - new ImmutableList.Builder<ZipInputEntry>(); + ImmutableList.Builder<ZipInputEntry> packagedFilesBuilder = new ImmutableList.Builder<>(); mergeInto(tempDir, fileSystem, control, /*bundleRoot=*/"", packagedFilesBuilder, mergeZipsBuilder, /*includePkgInfo=*/true); |