blob: 3dc53c5051e9ceb4254f7db7541a7ead3b5d56c1 [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",
Victor Changa490e2c2024-12-27 14:04:08 +000083 "LocaleDataLookup.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080084 "misc.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000085 "NinePatch.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080086 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020087 "PosixUtils.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000088 "Png.cpp",
89 "PngChunkFilter.cpp",
90 "PngCrunch.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -070091 "ResourceTimer.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080092 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080093 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080094 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000095 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080096 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050097 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080098 "ZipFileRO.cpp",
99 "ZipUtils.cpp",
100 ],
101 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -0700102 export_shared_lib_headers: ["libz"],
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000103 static_libs: [
104 "libincfs-utils",
105 "libpng",
106 ],
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000107 whole_static_libs: [
108 "libandroidfw_pathutils",
109 "libincfs-utils",
110 ],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000111 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800112 target: {
113 android: {
114 srcs: [
115 "BackupData.cpp",
116 "BackupHelpers.cpp",
Michael Hoisie7f86ad52024-10-16 03:45:29 +0000117 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800118 ],
119 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -0800120 "libbase",
121 "libbinder",
122 "liblog",
123 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000124 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800125 "libutils",
126 "libz",
127 ],
Piyush Mehrotraa10db392024-01-09 20:15:16 +0000128 static_libs: [
129 "libziparchive_for_incfs",
130 "backup_flags_cc_lib",
131 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800132 static: {
133 enabled: false,
134 },
135 },
136 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800137 shared: {
138 enabled: false,
139 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700140 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000141 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000142 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000143 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000144 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000145 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700146 ],
147 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700148 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700149 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800150 },
Michael Hoisie7f86ad52024-10-16 03:45:29 +0000151 host_linux: {
152 srcs: [
153 "CursorWindow.cpp",
154 ],
155 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800156 windows: {
157 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800158 },
159 },
Ivan Lozano02828742017-11-07 13:26:27 -0800160 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700161 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800162 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800163}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700164
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000165cc_library_static {
166 name: "libandroidfw_pathutils",
167 defaults: ["libandroidfw_defaults"],
168 host_supported: true,
169 export_include_dirs: ["include_pathutils"],
170 srcs: [
171 "PathUtils.cpp",
172 ],
173 shared_libs: [
174 "libutils",
175 ],
176 target: {
177 windows: {
178 enabled: true,
179 },
180 },
181 visibility: [
182 ":__subpackages__",
183 "//frameworks/base/tools/aapt",
184 ],
185}
186
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700187common_test_libs = [
188 "libandroidfw",
189 "libbase",
190 "libcutils",
191 "libutils",
192 "libziparchive",
193]
194
195cc_test {
196 name: "libandroidfw_tests",
197 host_supported: true,
198 defaults: ["libandroidfw_defaults"],
199 cppflags: [
200 // This is to suppress warnings/errors from gtest
201 "-Wno-unnamed-type-template-args",
202 ],
Yurii Zubrytskyidd2d7b32024-12-16 18:42:34 -0800203 require_root: true,
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700204 srcs: [
205 // Helpers/infra for testing.
206 "tests/CommonHelpers.cpp",
207 "tests/TestHelpers.cpp",
208 "tests/TestMain.cpp",
209
210 // Actual tests.
211 "tests/ApkAssets_test.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +0000212 "tests/ApkParsing_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700213 "tests/AppAsLib_test.cpp",
214 "tests/Asset_test.cpp",
215 "tests/AssetManager2_test.cpp",
216 "tests/AttributeFinder_test.cpp",
217 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000218 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700219 "tests/ByteBucketArray_test.cpp",
Yurii Zubrytskyi1e5452a2024-06-13 19:30:36 -0700220 "tests/CombinedIterator_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700221 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200222 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700223 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700224 "tests/DynamicRefTable_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000225 "tests/FileStream_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700226 "tests/Idmap_test.cpp",
227 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200228 "tests/Locale_test.cpp",
Victor Changa490e2c2024-12-27 14:04:08 +0000229 "tests/LocaleDataLookup_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000230 "tests/NinePatch_test.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -0700231 "tests/ResourceTimer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700232 "tests/ResourceUtils_test.cpp",
233 "tests/ResTable_test.cpp",
234 "tests/Split_test.cpp",
235 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000236 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700237 "tests/Theme_test.cpp",
238 "tests/TypeWrappers_test.cpp",
239 "tests/ZipUtils_test.cpp",
240 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800241 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700242 target: {
243 android: {
244 srcs: [
245 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600246 "tests/BackupHelpers_test.cpp",
247 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700248 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200249 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700250 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800251 shared_libs: common_test_libs + [
252 "libbinder",
253 "liblog",
254 "libui",
255 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700256 },
257 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800258 static_libs: common_test_libs + [
259 "liblog",
260 "libz",
261 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700262 },
263 },
Winson9947f1e2019-08-16 10:20:39 -0700264 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700265 "tests/data/**/*.apk",
266 "tests/data/**/*.arsc",
267 "tests/data/**/*.idmap",
Cole Faust5aeb9fd2024-10-22 16:30:57 -0700268 ],
269 device_common_data: [
Brandon Liu742b11e2022-11-03 23:23:28 +0000270 ":FrameworkResourcesSparseTestApp",
271 ":FrameworkResourcesNotSparseTestApp",
Winson9947f1e2019-08-16 10:20:39 -0700272 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800273 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700274}
275
276cc_benchmark {
277 name: "libandroidfw_benchmarks",
278 defaults: ["libandroidfw_defaults"],
Yurii Zubrytskyi72464742024-06-24 19:16:52 -0700279 test_config: "tests/AndroidTest_Benchmarks.xml",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700280 srcs: [
281 // Helpers/infra for benchmarking.
282 "tests/BenchMain.cpp",
283 "tests/BenchmarkHelpers.cpp",
284 "tests/CommonHelpers.cpp",
285
286 // Actual benchmarks.
287 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800288 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600289 "tests/CursorWindow_bench.cpp",
Yurii Zubrytskyi09144882023-06-15 23:23:15 -0700290 "tests/Generic_bench.cpp",
Victor Changd0dde3c2025-01-29 15:26:44 +0000291 "tests/LocaleDataLookup_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700292 "tests/SparseEntry_bench.cpp",
293 "tests/Theme_bench.cpp",
294 ],
295 shared_libs: common_test_libs,
Yurii Zubrytskyi72464742024-06-24 19:16:52 -0700296 data: [
297 "tests/data/**/*.apk",
298 ":FrameworkResourcesSparseTestApp",
299 ":FrameworkResourcesNotSparseTestApp",
300 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700301}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600302
303cc_library {
304 name: "libandroidfw_fuzzer_lib",
305 defaults: ["libandroidfw_defaults"],
306 host_supported: true,
307 srcs: [
308 "CursorWindow.cpp",
309 ],
310 export_include_dirs: ["include"],
311 target: {
312 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800313 shared_libs: common_test_libs + [
314 "libbinder",
315 "liblog",
316 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600317 },
318 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800319 static_libs: common_test_libs + [
320 "libbinder",
321 "liblog",
322 ],
323 },
324 darwin: {
325 // libbinder is not supported on mac
326 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600327 },
328 },
329}