Support robolectric zip expectations (similar to command line zip) am: e0c45acc6b

Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/20599614

Change-Id: I765e6900cd25803dfeddd6a8fd88c19d1a33c2fa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Rex Hoffman
2022-12-02 04:47:20 +00:00
committed by Automerger Merge Worker

View File

@@ -162,10 +162,18 @@ func (w *Writer) Close() error {
if records > uint16max {
records = uint16max
}
// END ANDROID CHANGE
// Only store uint32max for the size and the offset if they don't fit.
// Robolectric currently doesn't support zip64 and fails to find the
// offset to the central directory when the number of files in the zip
// is larger than 2^16.
if size > uint32max {
size = uint32max
}
if offset > uint32max {
offset = uint32max
}
// END ANDROID CHANGE
}
// write end record
var buf [directoryEndLen]byte