2016-07-13 03:45:19 +02:00
|
|
|
//
|
|
|
|
// Copyright (C) 2013 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "libziparchive_flags",
|
|
|
|
cflags: [
|
|
|
|
// ZLIB_CONST turns on const for input buffers, which is pretty standard.
|
|
|
|
"-DZLIB_CONST",
|
|
|
|
"-Werror",
|
|
|
|
"-Wall",
|
2016-12-20 17:13:41 +01:00
|
|
|
"-D_FILE_OFFSET_BITS=64",
|
2016-07-13 03:45:19 +02:00
|
|
|
],
|
|
|
|
cppflags: [
|
|
|
|
// Incorrectly warns when C++11 empty brace {} initializer is used.
|
|
|
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61489
|
|
|
|
"-Wno-missing-field-initializers",
|
2019-04-05 22:48:02 +02:00
|
|
|
"-Wconversion",
|
|
|
|
"-Wno-sign-conversion",
|
2016-07-13 03:45:19 +02:00
|
|
|
],
|
2018-09-18 23:58:17 +02:00
|
|
|
|
|
|
|
// Enable -Wold-style-cast only for non-Windows targets. _islower_l,
|
|
|
|
// _isupper_l etc. in MinGW locale_win32.h (included from
|
|
|
|
// libcxx/include/__locale) has an old-style-cast.
|
|
|
|
target: {
|
|
|
|
not_windows: {
|
|
|
|
cppflags: [
|
|
|
|
"-Wold-style-cast",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2019-03-20 21:04:02 +01:00
|
|
|
sanitize: {
|
|
|
|
misc_undefined: [
|
|
|
|
"signed-integer-overflow",
|
|
|
|
"unsigned-integer-overflow",
|
|
|
|
"shift",
|
|
|
|
"integer-divide-by-zero",
|
|
|
|
"implicit-signed-integer-truncation",
|
|
|
|
// TODO: Fix crash when we enable this option
|
|
|
|
// "implicit-unsigned-integer-truncation",
|
|
|
|
// TODO: not tested yet.
|
|
|
|
// "implicit-integer-sign-change",
|
|
|
|
],
|
|
|
|
},
|
2016-07-13 03:45:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_defaults {
|
|
|
|
name: "libziparchive_defaults",
|
|
|
|
srcs: [
|
|
|
|
"zip_archive.cc",
|
|
|
|
"zip_archive_stream_entry.cc",
|
|
|
|
"zip_writer.cc",
|
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
windows: {
|
|
|
|
cflags: ["-mno-ms-bitfields"],
|
|
|
|
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"liblog",
|
|
|
|
],
|
2017-07-06 07:02:54 +02:00
|
|
|
|
2019-07-03 02:25:03 +02:00
|
|
|
// for FRIEND_TEST
|
|
|
|
static_libs: ["libgtest_prod"],
|
|
|
|
export_static_lib_headers: ["libgtest_prod"],
|
|
|
|
|
2017-07-06 07:02:54 +02:00
|
|
|
export_include_dirs: ["include"],
|
2016-07-13 03:45:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
cc_library {
|
|
|
|
name: "libziparchive",
|
|
|
|
host_supported: true,
|
2017-05-29 07:59:04 +02:00
|
|
|
vendor_available: true,
|
2018-05-29 09:41:30 +02:00
|
|
|
recovery_available: true,
|
2019-05-06 14:01:58 +02:00
|
|
|
native_bridge_supported: true,
|
2017-08-03 08:51:33 +02:00
|
|
|
vndk: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
2018-04-09 05:20:48 +02:00
|
|
|
double_loadable: true,
|
2018-10-26 19:34:53 +02:00
|
|
|
export_shared_lib_headers: ["libbase"],
|
2017-05-16 22:09:54 +02:00
|
|
|
|
2017-05-29 07:59:04 +02:00
|
|
|
defaults: [
|
|
|
|
"libziparchive_defaults",
|
|
|
|
"libziparchive_flags",
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"liblog",
|
|
|
|
"libbase",
|
2017-09-28 01:24:45 +02:00
|
|
|
"libz",
|
2017-05-29 07:59:04 +02:00
|
|
|
],
|
2016-07-13 03:45:19 +02:00
|
|
|
target: {
|
2016-11-29 22:32:55 +01:00
|
|
|
linux_bionic: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
2016-07-13 03:45:19 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tests.
|
|
|
|
cc_test {
|
|
|
|
name: "ziparchive-tests",
|
|
|
|
host_supported: true,
|
|
|
|
defaults: ["libziparchive_flags"],
|
|
|
|
|
2018-04-25 21:49:19 +02:00
|
|
|
data: [
|
|
|
|
"testdata/**/*",
|
|
|
|
],
|
|
|
|
|
2016-07-13 03:45:19 +02:00
|
|
|
srcs: [
|
|
|
|
"entry_name_utils_test.cc",
|
|
|
|
"zip_archive_test.cc",
|
|
|
|
"zip_writer_test.cc",
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"liblog",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libziparchive",
|
|
|
|
"libz",
|
|
|
|
"libutils",
|
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
host: {
|
|
|
|
cppflags: ["-Wno-unnamed-type-template-args"],
|
|
|
|
},
|
|
|
|
windows: {
|
|
|
|
enabled: true,
|
|
|
|
},
|
|
|
|
},
|
2018-10-29 20:29:34 +01:00
|
|
|
test_suites: ["device-tests"],
|
2016-07-13 03:45:19 +02:00
|
|
|
}
|
2017-05-30 16:14:20 +02:00
|
|
|
|
|
|
|
// Performance benchmarks.
|
|
|
|
cc_benchmark {
|
|
|
|
name: "ziparchive-benchmarks",
|
|
|
|
defaults: ["libziparchive_flags"],
|
|
|
|
|
|
|
|
srcs: [
|
|
|
|
"zip_archive_benchmark.cpp",
|
|
|
|
],
|
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"liblog",
|
|
|
|
],
|
|
|
|
|
|
|
|
static_libs: [
|
|
|
|
"libziparchive",
|
|
|
|
"libz",
|
|
|
|
"libutils",
|
|
|
|
],
|
|
|
|
|
|
|
|
target: {
|
|
|
|
host: {
|
|
|
|
cppflags: ["-Wno-unnamed-type-template-args"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
2017-05-29 07:59:04 +02:00
|
|
|
|
|
|
|
cc_binary {
|
2019-10-25 18:57:58 +02:00
|
|
|
name: "ziptool",
|
2017-05-29 07:59:04 +02:00
|
|
|
defaults: ["libziparchive_flags"],
|
2019-12-14 01:45:55 +01:00
|
|
|
srcs: ["ziptool.cpp"],
|
2017-05-29 07:59:04 +02:00
|
|
|
shared_libs: [
|
|
|
|
"libbase",
|
|
|
|
"libziparchive",
|
|
|
|
],
|
2018-09-04 22:33:30 +02:00
|
|
|
recovery_available: true,
|
2019-10-25 18:57:58 +02:00
|
|
|
host_supported: true,
|
|
|
|
target: {
|
|
|
|
android: {
|
|
|
|
symlinks: ["unzip", "zipinfo"],
|
|
|
|
},
|
|
|
|
},
|
2017-05-29 07:59:04 +02:00
|
|
|
}
|
2019-10-22 20:44:50 +02:00
|
|
|
|
|
|
|
cc_fuzz {
|
|
|
|
name: "libziparchive_fuzzer",
|
|
|
|
srcs: ["libziparchive_fuzzer.cpp"],
|
|
|
|
static_libs: ["libziparchive", "libbase", "libz", "liblog"],
|
|
|
|
host_supported: true,
|
2019-11-07 23:24:04 +01:00
|
|
|
corpus: ["testdata/*"],
|
2019-10-22 20:44:50 +02:00
|
|
|
}
|
2019-11-16 00:07:00 +01:00
|
|
|
|
|
|
|
sh_test {
|
|
|
|
name: "ziptool-tests",
|
|
|
|
src: "run-ziptool-tests-on-android.sh",
|
|
|
|
filename: "run-ziptool-tests-on-android.sh",
|
|
|
|
test_suites: ["general-tests"],
|
|
|
|
host_supported: true,
|
|
|
|
device_supported: false,
|
|
|
|
test_config: "ziptool-tests.xml",
|
|
|
|
data: ["cli-tests/**/*"],
|
|
|
|
target_required: ["cli-test", "ziptool"],
|
|
|
|
}
|