diff options
author | Googler <noreply@google.com> | 2015-05-13 20:14:22 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2015-05-15 09:44:37 +0000 |
commit | 9cd94a49218b2dd4edafe1389148f8d6df5a534b (patch) | |
tree | 2019239bbb9a50c9c16124aad2c6479328730ff5 /src/tools/xcode-common | |
parent | 9263b46f85a63f8f9ad7d36103a306d65dfbee4f (diff) |
Update to use new, more performant, API of ZipCombiner instead of now deprecated features in XCode tooling.
--
MOS_MIGRATED_REVID=93552526
Diffstat (limited to 'src/tools/xcode-common')
-rw-r--r-- | src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java | 25 |
1 files changed, 13 insertions, 12 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 01aaad0373..0621716576 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 @@ -14,9 +14,12 @@ package com.google.devtools.build.xcode.zip; +import static com.google.devtools.build.singlejar.ZipCombiner.DOS_EPOCH; + 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; @@ -43,17 +46,12 @@ public class ZipInputEntry extends Value<ZipInputEntry> { public static final int EXECUTABLE_EXTERNAL_FILE_ATTRIBUTE = (0100755 << 16); /** - * The central directory record information that is used when adding a plain, non-executable file. + * 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. */ - 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); + public static final short MADE_BY_VERSION = (short) 0x031e; private final Path source; private final String zipPath; @@ -98,8 +96,11 @@ public class ZipInputEntry extends Value<ZipInputEntry> { */ public void add(ZipCombiner combiner) throws IOException { try (InputStream inputStream = Files.newInputStream(source)) { - combiner.addFile(zipPath, ZipCombiner.DOS_EPOCH, inputStream, - DEFAULT_DIRECTORY_ENTRY_INFO.withExternalFileAttribute(externalFileAttribute)); + ZipFileEntry entry = new ZipFileEntry(zipPath); + entry.setTime(DOS_EPOCH.getTime()); + entry.setVersion(MADE_BY_VERSION); + entry.setExternalAttributes(externalFileAttribute); + combiner.addFile(entry, inputStream); } } |