platform_build/tools/zipalign
weisu eae45315cd Write files in a temporary directory
Avoid writing test files in the build output directory which fails when
run with Bazel. This happens because Bazel's sandboxing environment
ensures that the test's working directory is unwritable.

See https://docs.bazel.build/versions/main/sandboxing.html for more
information.

Bug: 209687942
Test: atest --bazel-mode zipalign_tests
Test: atest zipalign_tests

Change-Id: Ie22f464830c1ffe4d38a94a16dbd39dafa7fe317
2021-12-22 00:06:14 +00:00
..
include Refactor zipalign to allow unit tests 2020-11-03 10:03:30 -08:00
tests Write files in a temporary directory 2021-12-22 00:06:14 +00:00
Android.bp [LSC] Add LOCAL_LICENSE_KINDS to build/make 2021-02-14 10:37:20 -08:00
OWNERS Add the janitors and someone from Studio. 2020-11-09 14:06:02 -08:00
README.txt
ZipAlign.cpp Fix zipalign alignment error 2020-11-11 17:00:22 -08:00
ZipAlignMain.cpp zipalign: use getopt 2021-07-17 07:19:09 +09:00
ZipEntry.cpp Update language to comply with Android's inclusive language guidance 2021-02-24 16:37:06 +00:00
ZipEntry.h Fix or suppress some google-runtime-int warnings. 2018-08-10 15:14:26 -07:00
ZipFile.cpp Zipalign: Avoid unnecessary padding 2021-09-14 15:20:42 -07:00
ZipFile.h Fix zipalign alignment error 2020-11-11 17:00:22 -08:00

zipalign -- zip archive alignment tool

usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
       zipalign -c [-v] <align> infile.zip

  -c : check alignment only (does not modify file)
  -f : overwrite existing outfile.zip
  -p : page align stored shared object files
  -v : verbose output
  <align> is in bytes, e.g. "4" provides 32-bit alignment
  infile.zip is an existing Zip archive
  outfile.zip will be created


The purpose of zipalign is to ensure that all uncompressed data starts
with a particular alignment relative to the start of the file.  This
allows those portions to be accessed directly with mmap() even if they
contain binary data with alignment restrictions.

Some data needs to be word-aligned for easy access, others might benefit
from being page-aligned.  The adjustment is made by altering the size of
the "extra" field in the zip Local File Header sections.  Existing data
in the "extra" fields may be altered by this process.

Compressed data isn't very useful until it's uncompressed, so there's no
need to adjust its alignment.

Alterations to the archive, such as renaming or deleting entries, will
potentially disrupt the alignment of the modified entry and all later
entries.  Files added to an "aligned" archive will not be aligned.

By default, zipalign will not overwrite an existing output file.  With the
"-f" flag, an existing file will be overwritten.

You can use the "-c" flag to test whether a zip archive is properly aligned.

The "-p" flag aligns any file with a ".so" extension, and which is stored
uncompressed in the zip archive, to a 4096-byte page boundary.  This
facilitates directly loading shared libraries from inside a zip archive.