aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc_tools
diff options
context:
space:
mode:
authorGravatar Matthew DeVore <matvore@google.com>2015-03-16 19:45:31 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2015-03-18 13:40:21 +0000
commit78d18e7ddec7c5d2bcd2507420fec9e05d1d5592 (patch)
tree92d7734a1ac5bff94082a1a07d9b54c0dd4a488a /src/objc_tools
parenta2c6bc71c28f567e3115b1ea740b37630aa16ffb (diff)
Propagate permissions of files in nested zips to the final zip.
-- MOS_MIGRATED_REVID=88753587
Diffstat (limited to 'src/objc_tools')
-rw-r--r--src/objc_tools/bundlemerge/java/com/google/devtools/build/xcode/bundlemerge/BundleMerging.java13
1 files changed, 10 insertions, 3 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 20b8b72c7d..69c00d3f9c 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
@@ -30,6 +30,7 @@ import com.google.devtools.build.xcode.common.Platform;
import com.google.devtools.build.xcode.common.TargetDeviceFamily;
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;
import java.io.IOException;
@@ -37,6 +38,7 @@ import java.io.OutputStream;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -184,15 +186,20 @@ public final class BundleMerging {
*/
private void addEntriesFromOtherZip(ZipCombiner combiner, Path sourceZip, String entryNamesPrefix)
throws IOException {
+ Map<String, Integer> externalFileAttributes = ZipFiles.unixExternalFileAttributes(sourceZip);
try (ZipInputStream zipIn = new ZipInputStream(Files.newInputStream(sourceZip))) {
while (true) {
ZipEntry zipInEntry = zipIn.getNextEntry();
if (zipInEntry == null) {
break;
}
- // TODO(bazel-team): preserve the external file attribute field in the source zip entry.
- combiner.addFile(entryNamesPrefix + zipInEntry.getName(), DOS_EPOCH, zipIn,
- ZipInputEntry.DEFAULT_DIRECTORY_ENTRY_INFO);
+ Integer externalFileAttr = externalFileAttributes.get(zipInEntry.getName());
+ if (externalFileAttr == null) {
+ externalFileAttr = ZipInputEntry.DEFAULT_EXTERNAL_FILE_ATTRIBUTE;
+ }
+ combiner.addFile(
+ entryNamesPrefix + zipInEntry.getName(), DOS_EPOCH, zipIn,
+ ZipInputEntry.DEFAULT_DIRECTORY_ENTRY_INFO.withExternalFileAttribute(externalFileAttr));
}
}
}