blob: 28bda72bccddd5b7abbff1de3ad48da3c7348063 [file] [log] [blame]
Colin Cross4f8d9e62016-12-01 15:55:00 -08001// Copyright (C) 2010 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// libandroidfw is partially built for the host (used by obbtool, aapt, and others)
16
Bob Badour8a6a2bc2021-02-12 17:07:05 -080017package {
18 default_applicable_licenses: ["frameworks_base_libs_androidfw_license"],
19}
20
21// Added automatically by a large-scale-change
22// See: http://go/android-license-faq
23license {
24 name: "frameworks_base_libs_androidfw_license",
25 visibility: [":__subpackages__"],
26 license_kinds: [
27 "SPDX-license-identifier-Apache-2.0",
28 ],
29 license_text: [
30 "NOTICE",
31 ],
32}
33
Adam Lesinski873ef0e2017-10-11 16:50:37 -070034cc_defaults {
35 name: "libandroidfw_defaults",
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -080036 cpp_std: "gnu++2b",
Colin Cross4f8d9e62016-12-01 15:55:00 -080037 cflags: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080038 "-Werror",
Colin Cross4f8d9e62016-12-01 15:55:00 -080039 "-Wunreachable-code",
40 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -070041 target: {
42 windows: {
43 // The Windows compiler warns incorrectly for value initialization with {}.
44 cppflags: ["-Wno-missing-field-initializers"],
45 },
46 host: {
47 cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
48 },
49 },
50}
51
52cc_library {
53 name: "libandroidfw",
54 defaults: ["libandroidfw_defaults"],
55 host_supported: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080056 srcs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -070057 "ApkAssets.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +000058 "ApkParsing.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080059 "Asset.cpp",
60 "AssetDir.cpp",
61 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070062 "AssetManager2.cpp",
Ryan Mitchell1a48fa62021-01-10 08:36:36 -080063 "AssetsProvider.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080064 "AttributeResolution.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000065 "BigBuffer.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070066 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020067 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070068 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070069 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020070 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080071 "LocaleData.cpp",
72 "misc.cpp",
73 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020074 "PosixUtils.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -070075 "ResourceTimer.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080076 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080077 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080078 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000079 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080080 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050081 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080082 "ZipFileRO.cpp",
83 "ZipUtils.cpp",
84 ],
85 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070086 export_shared_lib_headers: ["libz"],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000087 static_libs: ["libincfs-utils"],
88 whole_static_libs: ["libincfs-utils"],
89 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080090 target: {
91 android: {
92 srcs: [
93 "BackupData.cpp",
94 "BackupHelpers.cpp",
95 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080096 ],
97 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080098 "libbase",
99 "libbinder",
100 "liblog",
101 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000102 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800103 "libutils",
104 "libz",
105 ],
Yurii Zubrytskyi80d0f4c2021-02-26 03:53:04 -0500106 static_libs: ["libziparchive_for_incfs"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800107 static: {
108 enabled: false,
109 },
110 },
111 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800112 shared: {
113 enabled: false,
114 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700115 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000116 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000117 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000118 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000119 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000120 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700121 ],
122 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700123 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700124 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800125 },
Colin Crosse8f6f0b2022-03-08 18:17:43 -0800126 host_linux: {
Jerome Gaillard10447022020-11-02 16:16:17 +0000127 srcs: [
128 "CursorWindow.cpp",
129 ],
130 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800131 windows: {
132 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800133 },
134 },
Ivan Lozano02828742017-11-07 13:26:27 -0800135 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700136 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800137 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800138}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700139
140common_test_libs = [
141 "libandroidfw",
142 "libbase",
143 "libcutils",
144 "libutils",
145 "libziparchive",
146]
147
148cc_test {
149 name: "libandroidfw_tests",
150 host_supported: true,
151 defaults: ["libandroidfw_defaults"],
152 cppflags: [
153 // This is to suppress warnings/errors from gtest
154 "-Wno-unnamed-type-template-args",
155 ],
156 srcs: [
157 // Helpers/infra for testing.
158 "tests/CommonHelpers.cpp",
159 "tests/TestHelpers.cpp",
160 "tests/TestMain.cpp",
161
162 // Actual tests.
163 "tests/ApkAssets_test.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +0000164 "tests/ApkParsing_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700165 "tests/AppAsLib_test.cpp",
166 "tests/Asset_test.cpp",
167 "tests/AssetManager2_test.cpp",
168 "tests/AttributeFinder_test.cpp",
169 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000170 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700171 "tests/ByteBucketArray_test.cpp",
172 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200173 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700174 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700175 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700176 "tests/Idmap_test.cpp",
177 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200178 "tests/Locale_test.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -0700179 "tests/ResourceTimer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700180 "tests/ResourceUtils_test.cpp",
181 "tests/ResTable_test.cpp",
182 "tests/Split_test.cpp",
183 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000184 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700185 "tests/Theme_test.cpp",
186 "tests/TypeWrappers_test.cpp",
187 "tests/ZipUtils_test.cpp",
188 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800189 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700190 target: {
191 android: {
192 srcs: [
193 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600194 "tests/BackupHelpers_test.cpp",
195 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700196 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200197 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700198 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800199 shared_libs: common_test_libs + [
200 "libbinder",
201 "liblog",
202 "libui",
203 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700204 },
205 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800206 static_libs: common_test_libs + [
207 "liblog",
208 "libz",
209 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700210 },
211 },
Winson9947f1e2019-08-16 10:20:39 -0700212 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700213 "tests/data/**/*.apk",
214 "tests/data/**/*.arsc",
215 "tests/data/**/*.idmap",
Brandon Liu742b11e2022-11-03 23:23:28 +0000216 ":FrameworkResourcesSparseTestApp",
217 ":FrameworkResourcesNotSparseTestApp",
Winson9947f1e2019-08-16 10:20:39 -0700218 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800219 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700220}
221
222cc_benchmark {
223 name: "libandroidfw_benchmarks",
224 defaults: ["libandroidfw_defaults"],
225 srcs: [
226 // Helpers/infra for benchmarking.
227 "tests/BenchMain.cpp",
228 "tests/BenchmarkHelpers.cpp",
229 "tests/CommonHelpers.cpp",
230
231 // Actual benchmarks.
232 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800233 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600234 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700235 "tests/SparseEntry_bench.cpp",
236 "tests/Theme_bench.cpp",
237 ],
238 shared_libs: common_test_libs,
239 data: ["tests/data/**/*.apk"],
240}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600241
242cc_library {
243 name: "libandroidfw_fuzzer_lib",
244 defaults: ["libandroidfw_defaults"],
245 host_supported: true,
246 srcs: [
247 "CursorWindow.cpp",
248 ],
249 export_include_dirs: ["include"],
250 target: {
251 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800252 shared_libs: common_test_libs + [
253 "libbinder",
254 "liblog",
255 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600256 },
257 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800258 static_libs: common_test_libs + [
259 "libbinder",
260 "liblog",
261 ],
262 },
263 darwin: {
264 // libbinder is not supported on mac
265 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600266 },
267 },
268}