blob: 77800a305f02d83c4604afebb9bcacf517ddbe75 [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 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -070047 target: {
48 windows: {
49 // The Windows compiler warns incorrectly for value initialization with {}.
50 cppflags: ["-Wno-missing-field-initializers"],
51 },
52 host: {
53 cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
54 },
55 },
56}
57
58cc_library {
59 name: "libandroidfw",
60 defaults: ["libandroidfw_defaults"],
61 host_supported: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080062 srcs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -070063 "ApkAssets.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +000064 "ApkParsing.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080065 "Asset.cpp",
66 "AssetDir.cpp",
67 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070068 "AssetManager2.cpp",
Ryan Mitchell1a48fa62021-01-10 08:36:36 -080069 "AssetsProvider.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080070 "AttributeResolution.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000071 "BigBuffer.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000072 "BigBufferStream.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070073 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020074 "ConfigDescription.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000075 "FileStream.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070076 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070077 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020078 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080079 "LocaleData.cpp",
80 "misc.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000081 "NinePatch.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080082 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020083 "PosixUtils.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000084 "Png.cpp",
85 "PngChunkFilter.cpp",
86 "PngCrunch.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -070087 "ResourceTimer.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080088 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080089 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080090 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000091 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080092 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050093 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080094 "ZipFileRO.cpp",
95 "ZipUtils.cpp",
96 ],
97 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070098 export_shared_lib_headers: ["libz"],
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000099 static_libs: [
100 "libincfs-utils",
101 "libpng",
102 ],
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000103 whole_static_libs: [
104 "libandroidfw_pathutils",
105 "libincfs-utils",
106 ],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000107 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800108 target: {
109 android: {
110 srcs: [
111 "BackupData.cpp",
112 "BackupHelpers.cpp",
113 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800114 ],
115 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -0800116 "libbase",
117 "libbinder",
118 "liblog",
119 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000120 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800121 "libutils",
122 "libz",
123 ],
Piyush Mehrotraa10db392024-01-09 20:15:16 +0000124 static_libs: [
125 "libziparchive_for_incfs",
126 "backup_flags_cc_lib",
127 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800128 static: {
129 enabled: false,
130 },
131 },
132 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800133 shared: {
134 enabled: false,
135 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700136 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000137 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000138 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000139 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000140 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000141 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700142 ],
143 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700144 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700145 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800146 },
Colin Crosse8f6f0b2022-03-08 18:17:43 -0800147 host_linux: {
Jerome Gaillard10447022020-11-02 16:16:17 +0000148 srcs: [
149 "CursorWindow.cpp",
150 ],
151 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800152 windows: {
153 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800154 },
155 },
Ivan Lozano02828742017-11-07 13:26:27 -0800156 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700157 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800158 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800159}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700160
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000161cc_library_static {
162 name: "libandroidfw_pathutils",
163 defaults: ["libandroidfw_defaults"],
164 host_supported: true,
165 export_include_dirs: ["include_pathutils"],
166 srcs: [
167 "PathUtils.cpp",
168 ],
169 shared_libs: [
170 "libutils",
171 ],
172 target: {
173 windows: {
174 enabled: true,
175 },
176 },
177 visibility: [
178 ":__subpackages__",
179 "//frameworks/base/tools/aapt",
180 ],
181}
182
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700183common_test_libs = [
184 "libandroidfw",
185 "libbase",
186 "libcutils",
187 "libutils",
188 "libziparchive",
189]
190
191cc_test {
192 name: "libandroidfw_tests",
193 host_supported: true,
194 defaults: ["libandroidfw_defaults"],
195 cppflags: [
196 // This is to suppress warnings/errors from gtest
197 "-Wno-unnamed-type-template-args",
198 ],
199 srcs: [
200 // Helpers/infra for testing.
201 "tests/CommonHelpers.cpp",
202 "tests/TestHelpers.cpp",
203 "tests/TestMain.cpp",
204
205 // Actual tests.
206 "tests/ApkAssets_test.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +0000207 "tests/ApkParsing_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700208 "tests/AppAsLib_test.cpp",
209 "tests/Asset_test.cpp",
210 "tests/AssetManager2_test.cpp",
211 "tests/AttributeFinder_test.cpp",
212 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000213 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700214 "tests/ByteBucketArray_test.cpp",
215 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200216 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700217 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700218 "tests/DynamicRefTable_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000219 "tests/FileStream_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700220 "tests/Idmap_test.cpp",
221 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200222 "tests/Locale_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000223 "tests/NinePatch_test.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -0700224 "tests/ResourceTimer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700225 "tests/ResourceUtils_test.cpp",
226 "tests/ResTable_test.cpp",
227 "tests/Split_test.cpp",
228 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000229 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700230 "tests/Theme_test.cpp",
231 "tests/TypeWrappers_test.cpp",
232 "tests/ZipUtils_test.cpp",
233 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800234 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700235 target: {
236 android: {
237 srcs: [
238 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600239 "tests/BackupHelpers_test.cpp",
240 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700241 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200242 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700243 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800244 shared_libs: common_test_libs + [
245 "libbinder",
246 "liblog",
247 "libui",
248 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700249 },
250 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800251 static_libs: common_test_libs + [
252 "liblog",
253 "libz",
254 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700255 },
256 },
Winson9947f1e2019-08-16 10:20:39 -0700257 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700258 "tests/data/**/*.apk",
259 "tests/data/**/*.arsc",
260 "tests/data/**/*.idmap",
Brandon Liu742b11e2022-11-03 23:23:28 +0000261 ":FrameworkResourcesSparseTestApp",
262 ":FrameworkResourcesNotSparseTestApp",
Winson9947f1e2019-08-16 10:20:39 -0700263 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800264 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700265}
266
267cc_benchmark {
268 name: "libandroidfw_benchmarks",
269 defaults: ["libandroidfw_defaults"],
270 srcs: [
271 // Helpers/infra for benchmarking.
272 "tests/BenchMain.cpp",
273 "tests/BenchmarkHelpers.cpp",
274 "tests/CommonHelpers.cpp",
275
276 // Actual benchmarks.
277 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800278 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600279 "tests/CursorWindow_bench.cpp",
Yurii Zubrytskyi09144882023-06-15 23:23:15 -0700280 "tests/Generic_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700281 "tests/SparseEntry_bench.cpp",
282 "tests/Theme_bench.cpp",
283 ],
284 shared_libs: common_test_libs,
285 data: ["tests/data/**/*.apk"],
286}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600287
288cc_library {
289 name: "libandroidfw_fuzzer_lib",
290 defaults: ["libandroidfw_defaults"],
291 host_supported: true,
292 srcs: [
293 "CursorWindow.cpp",
294 ],
295 export_include_dirs: ["include"],
296 target: {
297 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800298 shared_libs: common_test_libs + [
299 "libbinder",
300 "liblog",
301 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600302 },
303 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800304 static_libs: common_test_libs + [
305 "libbinder",
306 "liblog",
307 ],
308 },
309 darwin: {
310 // libbinder is not supported on mac
311 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600312 },
313 },
314}