platform_build/tools/zipalign/Android.bp
Fabien Sanglard 8163cfa5f4 Zipalign: Don't align directory entries
Directories are entries with uncompressed size zero and ending with
character '/' or '\' are allowed in apks since b/204425803. These
entries should not be considered for alignment since they are not
mmap by the framework.

Test: align_test.cpp
Bug: 250872480
Change-Id: I964aad118a82839f9ed230acc4c2c76f51888c67
2022-10-12 13:57:16 -07:00

80 lines
1.5 KiB
Text

//
// Copyright 2008 The Android Open Source Project
//
// Zip alignment tool
//
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_defaults {
name: "zipalign_defaults",
target: {
windows: {
host_ldlibs: ["-lpthread"],
enabled: true,
},
},
}
cc_library_host_static {
name: "libzipalign",
srcs: [
"ZipAlign.cpp",
"ZipEntry.cpp",
"ZipFile.cpp",
],
export_include_dirs: [
"include",
],
cflags: ["-Wall", "-Werror"],
// NOTE: Do not add any shared_libs dependencies because they will break the
// static_sdk_tools target.
whole_static_libs: [
"libutils",
"libcutils",
"liblog",
"libziparchive",
"libz",
"libbase",
"libzopfli",
],
defaults: ["zipalign_defaults"],
}
cc_binary_host {
name: "zipalign",
srcs: [
"ZipAlignMain.cpp",
],
cflags: ["-Wall", "-Werror"],
static_libs: [
"libzipalign",
],
defaults: ["zipalign_defaults"],
}
cc_test_host {
name: "zipalign_tests",
srcs: [
"tests/src/*_test.cpp",
],
test_options: {
unit_test: true,
},
static_libs: [
"libbase",
"libzipalign",
"libgmock",
],
data: [
"tests/data/archiveWithOneDirectoryEntry.zip",
"tests/data/diffOrders.zip",
"tests/data/holes.zip",
"tests/data/unaligned.zip",
],
defaults: ["zipalign_defaults"],
test_suites: ["general-tests"],
}