blob: a39f30bbad1f5a2f66222a240ea2979d18203c85 [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
Piyush Mehrotraa10db392024-01-09 20:15:16 +000034cc_aconfig_library {
35 name: "backup_flags_cc_lib",
36 host_supported: true,
37 aconfig_declarations: "backup_flags",
38}
39
Adam Lesinski873ef0e2017-10-11 16:50:37 -070040cc_defaults {
41 name: "libandroidfw_defaults",
Yurii Zubrytskyiba6f8a32022-02-16 17:00:42 -080042 cpp_std: "gnu++2b",
Colin Cross4f8d9e62016-12-01 15:55:00 -080043 cflags: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080044 "-Werror",
Colin Cross4f8d9e62016-12-01 15:55:00 -080045 "-Wunreachable-code",
46 ],
Yurii Zubrytskyif51c1df2024-07-22 15:48:22 -070047 header_libs: [
48 "native_headers",
49 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -070050 target: {
51 windows: {
52 // The Windows compiler warns incorrectly for value initialization with {}.
53 cppflags: ["-Wno-missing-field-initializers"],
54 },
55 host: {
56 cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
57 },
58 },
59}
60
61cc_library {
62 name: "libandroidfw",
63 defaults: ["libandroidfw_defaults"],
64 host_supported: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080065 srcs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -070066 "ApkAssets.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +000067 "ApkParsing.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080068 "Asset.cpp",
69 "AssetDir.cpp",
70 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070071 "AssetManager2.cpp",
Ryan Mitchell1a48fa62021-01-10 08:36:36 -080072 "AssetsProvider.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080073 "AttributeResolution.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000074 "BigBuffer.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000075 "BigBufferStream.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070076 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020077 "ConfigDescription.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000078 "FileStream.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070079 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070080 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020081 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080082 "LocaleData.cpp",
83 "misc.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000084 "NinePatch.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080085 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020086 "PosixUtils.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000087 "Png.cpp",
88 "PngChunkFilter.cpp",
89 "PngCrunch.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -070090 "ResourceTimer.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080091 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080092 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080093 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000094 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080095 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050096 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080097 "ZipFileRO.cpp",
98 "ZipUtils.cpp",
99 ],
100 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -0700101 export_shared_lib_headers: ["libz"],
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000102 static_libs: [
103 "libincfs-utils",
104 "libpng",
105 ],
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000106 whole_static_libs: [
107 "libandroidfw_pathutils",
108 "libincfs-utils",
109 ],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000110 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800111 target: {
112 android: {
113 srcs: [
114 "BackupData.cpp",
115 "BackupHelpers.cpp",
Michael Hoisie7f86ad52024-10-16 03:45:29 +0000116 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800117 ],
118 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -0800119 "libbase",
120 "libbinder",
121 "liblog",
122 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000123 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800124 "libutils",
125 "libz",
126 ],
Piyush Mehrotraa10db392024-01-09 20:15:16 +0000127 static_libs: [
128 "libziparchive_for_incfs",
129 "backup_flags_cc_lib",
130 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800131 static: {
132 enabled: false,
133 },
134 },
135 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800136 shared: {
137 enabled: false,
138 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700139 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000140 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000141 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000142 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000143 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000144 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700145 ],
146 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700147 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700148 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800149 },
Michael Hoisie7f86ad52024-10-16 03:45:29 +0000150 host_linux: {
151 srcs: [
152 "CursorWindow.cpp",
153 ],
154 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800155 windows: {
156 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800157 },
158 },
Ivan Lozano02828742017-11-07 13:26:27 -0800159 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700160 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800161 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800162}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700163
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000164cc_library_static {
165 name: "libandroidfw_pathutils",
166 defaults: ["libandroidfw_defaults"],
167 host_supported: true,
168 export_include_dirs: ["include_pathutils"],
169 srcs: [
170 "PathUtils.cpp",
171 ],
172 shared_libs: [
173 "libutils",
174 ],
175 target: {
176 windows: {
177 enabled: true,
178 },
179 },
180 visibility: [
181 ":__subpackages__",
182 "//frameworks/base/tools/aapt",
183 ],
184}
185
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700186common_test_libs = [
187 "libandroidfw",
188 "libbase",
189 "libcutils",
190 "libutils",
191 "libziparchive",
192]
193
194cc_test {
195 name: "libandroidfw_tests",
196 host_supported: true,
197 defaults: ["libandroidfw_defaults"],
198 cppflags: [
199 // This is to suppress warnings/errors from gtest
200 "-Wno-unnamed-type-template-args",
201 ],
202 srcs: [
203 // Helpers/infra for testing.
204 "tests/CommonHelpers.cpp",
205 "tests/TestHelpers.cpp",
206 "tests/TestMain.cpp",
207
208 // Actual tests.
209 "tests/ApkAssets_test.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +0000210 "tests/ApkParsing_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700211 "tests/AppAsLib_test.cpp",
212 "tests/Asset_test.cpp",
213 "tests/AssetManager2_test.cpp",
214 "tests/AttributeFinder_test.cpp",
215 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000216 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700217 "tests/ByteBucketArray_test.cpp",
Yurii Zubrytskyi1e5452a2024-06-13 19:30:36 -0700218 "tests/CombinedIterator_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700219 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200220 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700221 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700222 "tests/DynamicRefTable_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000223 "tests/FileStream_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700224 "tests/Idmap_test.cpp",
225 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200226 "tests/Locale_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000227 "tests/NinePatch_test.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -0700228 "tests/ResourceTimer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700229 "tests/ResourceUtils_test.cpp",
230 "tests/ResTable_test.cpp",
231 "tests/Split_test.cpp",
232 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000233 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700234 "tests/Theme_test.cpp",
235 "tests/TypeWrappers_test.cpp",
236 "tests/ZipUtils_test.cpp",
237 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800238 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700239 target: {
240 android: {
241 srcs: [
242 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600243 "tests/BackupHelpers_test.cpp",
244 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700245 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200246 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700247 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800248 shared_libs: common_test_libs + [
249 "libbinder",
250 "liblog",
251 "libui",
252 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700253 },
254 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800255 static_libs: common_test_libs + [
256 "liblog",
257 "libz",
258 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700259 },
260 },
Winson9947f1e2019-08-16 10:20:39 -0700261 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700262 "tests/data/**/*.apk",
263 "tests/data/**/*.arsc",
264 "tests/data/**/*.idmap",
Brandon Liu742b11e2022-11-03 23:23:28 +0000265 ":FrameworkResourcesSparseTestApp",
266 ":FrameworkResourcesNotSparseTestApp",
Winson9947f1e2019-08-16 10:20:39 -0700267 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800268 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700269}
270
271cc_benchmark {
272 name: "libandroidfw_benchmarks",
273 defaults: ["libandroidfw_defaults"],
Yurii Zubrytskyi72464742024-06-24 19:16:52 -0700274 test_config: "tests/AndroidTest_Benchmarks.xml",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700275 srcs: [
276 // Helpers/infra for benchmarking.
277 "tests/BenchMain.cpp",
278 "tests/BenchmarkHelpers.cpp",
279 "tests/CommonHelpers.cpp",
280
281 // Actual benchmarks.
282 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800283 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600284 "tests/CursorWindow_bench.cpp",
Yurii Zubrytskyi09144882023-06-15 23:23:15 -0700285 "tests/Generic_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700286 "tests/SparseEntry_bench.cpp",
287 "tests/Theme_bench.cpp",
288 ],
289 shared_libs: common_test_libs,
Yurii Zubrytskyi72464742024-06-24 19:16:52 -0700290 data: [
291 "tests/data/**/*.apk",
292 ":FrameworkResourcesSparseTestApp",
293 ":FrameworkResourcesNotSparseTestApp",
294 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700295}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600296
297cc_library {
298 name: "libandroidfw_fuzzer_lib",
299 defaults: ["libandroidfw_defaults"],
300 host_supported: true,
301 srcs: [
302 "CursorWindow.cpp",
303 ],
304 export_include_dirs: ["include"],
305 target: {
306 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800307 shared_libs: common_test_libs + [
308 "libbinder",
309 "liblog",
310 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600311 },
312 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800313 static_libs: common_test_libs + [
314 "libbinder",
315 "liblog",
316 ],
317 },
318 darwin: {
319 // libbinder is not supported on mac
320 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600321 },
322 },
323}