diff options
author | Googler <noreply@google.com> | 2015-07-09 17:45:13 +0000 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@google.com> | 2015-07-10 17:19:09 +0000 |
commit | db0b68de9e973a81848f49294485d7e8b6f5ec39 (patch) | |
tree | 63558a1ea9ff6e722994697f75e15d55b2c77984 /src/objc_tools/bundlemerge | |
parent | 491ed5e57521407b03e01a9e097c7dbd8272ff12 (diff) |
Allows bundlemerge to handle zip files that have directory entries in them. Directory entries are allowed to exist in multiple zip files. File entries are only allowed to exist in one zip file.
RELNOTES:None
--
MOS_MIGRATED_REVID=97887821
Diffstat (limited to 'src/objc_tools/bundlemerge')
-rw-r--r-- | src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java | 21 |
1 files changed, 17 insertions, 4 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 f418d8c8f3..65a9f890bb 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 @@ -47,7 +47,7 @@ import javax.annotation.CheckReturnValue; /** * Implementation of the final steps to create an iOS application bundle. * - * TODO(bazel-team): Add asset catalog compilation and bundling to this logic. + * <p>TODO(bazel-team): Add asset catalog compilation and bundling to this logic. */ public final class BundleMerging { @VisibleForTesting final FileSystem fileSystem; @@ -121,11 +121,11 @@ public final class BundleMerging { if (control.hasExecutableName()) { plistMerging.setExecutableName(control.getExecutableName()); } - + plistMerging.setBundleIdentifier( control.hasPrimaryBundleIdentifier() ? control.getPrimaryBundleIdentifier() : null, control.hasFallbackBundleIdentifier() ? control.getFallbackBundleIdentifier() : null); - + plistMerging.write(tempMergedPlist, tempPkgInfo); @@ -193,11 +193,24 @@ public final class BundleMerging { if (zipInEntry == null) { break; } + // TODO(bazel-dev): Add support for soft links because we will need them for MacOS support + // in frameworks at the very least. https://github.com/google/bazel/issues/289 + String name = entryNamesPrefix + zipInEntry.getName(); + if (zipInEntry.isDirectory()) { + // If we already have a directory entry with this name then don't attempt to + // add it again. It's not an error to attempt to merge in two zip files that contain + // the same directories. It's only an error to attempt to merge in two zip files with the + // same leaf files. + if (!combiner.containsFile(name)) { + combiner.addDirectory(name, DOS_EPOCH); + } + continue; + } Integer externalFileAttr = externalFileAttributes.get(zipInEntry.getName()); if (externalFileAttr == null) { externalFileAttr = ZipInputEntry.DEFAULT_EXTERNAL_FILE_ATTRIBUTE; } - ZipFileEntry zipOutEntry = new ZipFileEntry(entryNamesPrefix + zipInEntry.getName()); + ZipFileEntry zipOutEntry = new ZipFileEntry(name); zipOutEntry.setTime(DOS_EPOCH.getTime()); zipOutEntry.setVersion(ZipInputEntry.MADE_BY_VERSION); zipOutEntry.setExternalAttributes(externalFileAttr); |