aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/tools/xcode-common
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-04-03 21:13:50 +0000
committerGravatar John Field <jfield@google.com>2015-04-06 18:47:40 +0000
commit3ae9aa12e111d9e266bd605c37f94c2273f1bab9 (patch)
tree9f9aa955e245cdc81ebb0ede0319e5c8c23a2f6a /src/tools/xcode-common
parentbf73db9da19e37ed0823d9822710922be2e14f40 (diff)
Automated [] rollback of [].
*** Reason for rollback *** New ZipCombiner creates malformed output ZIP files when input ZIP files contain more than 65535 entries, the maximum amount for non-64-bit ZIP files. *** Original change description *** Rewrite of ZipCombiner to improve performance and maintainability. Added devtools/build/zip to allow reading and writing of ZIP files without requiring decompressing file data to manipulate them. ZipCombiner API has some changes. ZipCombiner#addZip takes a File instead of InputStream. ZipCombiner#addFile takes a ZipFileEntry instead of DirectoryEntryInfo -- MOS_MIGRATED_REVID=90279976
Diffstat (limited to 'src/tools/xcode-common')
-rw-r--r--src/tools/xcode-common/java/com/google/devtools/build/xcode/zip/ZipInputEntry.java23
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));
}
}