diff options
Diffstat (limited to 'src/tools/xcode-common')
-rw-r--r-- | src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java index 6bd6fdb893..01aaad0373 100644 --- a/src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java +++ b/src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java @@ -17,7 +17,6 @@ package com.google.devtools.build.xcode.zip; import com.google.common.collect.ImmutableList; import com.google.devtools.build.singlejar.ZipCombiner; import com.google.devtools.build.xcode.util.Value; -import com.google.devtools.build.zip.ZipFileEntry; import java.io.IOException; import java.io.InputStream; @@ -44,12 +43,17 @@ public class ZipInputEntry extends Value<ZipInputEntry> { public static final int EXECUTABLE_EXTERNAL_FILE_ATTRIBUTE = (0100755 << 16); /** - * Made by version of .ipa files built by Xcode. Upper byte indicates Unix host. Lower byte - * indicates version of encoding software (note that 0x1e = 30 = (3.0 * 10), so 0x1e translates - * to 3.0). The Unix host value in the upper byte is what causes the external file attribute to - * be interpreted as POSIX permission and file type bits. + * The central directory record information that is used when adding a plain, non-executable file. */ - public static final short MADE_BY_VERSION = (short) 0x031e; + public static final ZipCombiner.DirectoryEntryInfo DEFAULT_DIRECTORY_ENTRY_INFO = + ZipCombiner.DEFAULT_DIRECTORY_ENTRY_INFO + // This is what .ipa files built by Xcode are set to. Upper byte indicates Unix host. + // Lower byte indicates version of encoding software + // (note that 0x1e = 30 = (3.0 * 10), so 0x1e translates to 3.0). + // The Unix host value in the upper byte is what causes the external file attribute to be + // interpreted as POSIX permission and file type bits. + .withMadeByVersion((short) 0x031e) + .withExternalFileAttribute(DEFAULT_EXTERNAL_FILE_ATTRIBUTE); private final Path source; private final String zipPath; @@ -94,11 +98,8 @@ public class ZipInputEntry extends Value<ZipInputEntry> { */ public void add(ZipCombiner combiner) throws IOException { try (InputStream inputStream = Files.newInputStream(source)) { - ZipFileEntry entry = new ZipFileEntry(zipPath); - entry.setTime(ZipCombiner.DOS_EPOCH.getTime()); - entry.setVersion(MADE_BY_VERSION); - entry.setExternalAttributes(externalFileAttribute); - combiner.addFile(entry, inputStream); + combiner.addFile(zipPath, ZipCombiner.DOS_EPOCH, inputStream, + DEFAULT_DIRECTORY_ENTRY_INFO.withExternalFileAttribute(externalFileAttribute)); } } |