blob: 2f28363aedc7d9b2bf99d1b0fff434a469224c77 [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",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000066 "BigBufferStream.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070067 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020068 "ConfigDescription.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000069 "FileStream.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070070 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070071 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020072 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080073 "LocaleData.cpp",
74 "misc.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000075 "NinePatch.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080076 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020077 "PosixUtils.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000078 "Png.cpp",
79 "PngChunkFilter.cpp",
80 "PngCrunch.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -070081 "ResourceTimer.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080082 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080083 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080084 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000085 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080086 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050087 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080088 "ZipFileRO.cpp",
89 "ZipUtils.cpp",
90 ],
91 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070092 export_shared_lib_headers: ["libz"],
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +000093 static_libs: [
94 "libincfs-utils",
95 "libpng",
96 ],
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +000097 whole_static_libs: [
98 "libandroidfw_pathutils",
99 "libincfs-utils",
100 ],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000101 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800102 target: {
103 android: {
104 srcs: [
105 "BackupData.cpp",
106 "BackupHelpers.cpp",
107 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800108 ],
109 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -0800110 "libbase",
111 "libbinder",
112 "liblog",
113 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000114 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800115 "libutils",
116 "libz",
117 ],
Yurii Zubrytskyi80d0f4c2021-02-26 03:53:04 -0500118 static_libs: ["libziparchive_for_incfs"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800119 static: {
120 enabled: false,
121 },
122 },
123 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800124 shared: {
125 enabled: false,
126 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700127 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000128 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000129 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000130 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000131 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000132 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700133 ],
134 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700135 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700136 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800137 },
Colin Crosse8f6f0b2022-03-08 18:17:43 -0800138 host_linux: {
Jerome Gaillard10447022020-11-02 16:16:17 +0000139 srcs: [
140 "CursorWindow.cpp",
141 ],
142 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800143 windows: {
144 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800145 },
146 },
Ivan Lozano02828742017-11-07 13:26:27 -0800147 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700148 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800149 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800150}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700151
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000152cc_library_static {
153 name: "libandroidfw_pathutils",
154 defaults: ["libandroidfw_defaults"],
155 host_supported: true,
156 export_include_dirs: ["include_pathutils"],
157 srcs: [
158 "PathUtils.cpp",
159 ],
160 shared_libs: [
161 "libutils",
162 ],
163 target: {
164 windows: {
165 enabled: true,
166 },
167 },
168 visibility: [
169 ":__subpackages__",
170 "//frameworks/base/tools/aapt",
171 ],
172}
173
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700174common_test_libs = [
175 "libandroidfw",
176 "libbase",
177 "libcutils",
178 "libutils",
179 "libziparchive",
180]
181
182cc_test {
183 name: "libandroidfw_tests",
184 host_supported: true,
185 defaults: ["libandroidfw_defaults"],
186 cppflags: [
187 // This is to suppress warnings/errors from gtest
188 "-Wno-unnamed-type-template-args",
189 ],
190 srcs: [
191 // Helpers/infra for testing.
192 "tests/CommonHelpers.cpp",
193 "tests/TestHelpers.cpp",
194 "tests/TestMain.cpp",
195
196 // Actual tests.
197 "tests/ApkAssets_test.cpp",
Jeremy Meyer5fd34ea2022-12-15 18:43:36 +0000198 "tests/ApkParsing_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700199 "tests/AppAsLib_test.cpp",
200 "tests/Asset_test.cpp",
201 "tests/AssetManager2_test.cpp",
202 "tests/AttributeFinder_test.cpp",
203 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000204 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700205 "tests/ByteBucketArray_test.cpp",
206 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200207 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700208 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700209 "tests/DynamicRefTable_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000210 "tests/FileStream_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700211 "tests/Idmap_test.cpp",
212 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200213 "tests/Locale_test.cpp",
Jeremy Meyerb4f83ff2023-11-30 19:29:50 +0000214 "tests/NinePatch_test.cpp",
Lee Shombert3e4d9f22022-09-18 18:02:31 -0700215 "tests/ResourceTimer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700216 "tests/ResourceUtils_test.cpp",
217 "tests/ResTable_test.cpp",
218 "tests/Split_test.cpp",
219 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000220 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700221 "tests/Theme_test.cpp",
222 "tests/TypeWrappers_test.cpp",
223 "tests/ZipUtils_test.cpp",
224 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800225 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700226 target: {
227 android: {
228 srcs: [
229 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600230 "tests/BackupHelpers_test.cpp",
231 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700232 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200233 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700234 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800235 shared_libs: common_test_libs + [
236 "libbinder",
237 "liblog",
238 "libui",
239 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700240 },
241 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800242 static_libs: common_test_libs + [
243 "liblog",
244 "libz",
245 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700246 },
247 },
Winson9947f1e2019-08-16 10:20:39 -0700248 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700249 "tests/data/**/*.apk",
250 "tests/data/**/*.arsc",
251 "tests/data/**/*.idmap",
Brandon Liu742b11e2022-11-03 23:23:28 +0000252 ":FrameworkResourcesSparseTestApp",
253 ":FrameworkResourcesNotSparseTestApp",
Winson9947f1e2019-08-16 10:20:39 -0700254 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800255 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700256}
257
258cc_benchmark {
259 name: "libandroidfw_benchmarks",
260 defaults: ["libandroidfw_defaults"],
261 srcs: [
262 // Helpers/infra for benchmarking.
263 "tests/BenchMain.cpp",
264 "tests/BenchmarkHelpers.cpp",
265 "tests/CommonHelpers.cpp",
266
267 // Actual benchmarks.
268 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800269 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600270 "tests/CursorWindow_bench.cpp",
Yurii Zubrytskyi09144882023-06-15 23:23:15 -0700271 "tests/Generic_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700272 "tests/SparseEntry_bench.cpp",
273 "tests/Theme_bench.cpp",
274 ],
275 shared_libs: common_test_libs,
276 data: ["tests/data/**/*.apk"],
277}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600278
279cc_library {
280 name: "libandroidfw_fuzzer_lib",
281 defaults: ["libandroidfw_defaults"],
282 host_supported: true,
283 srcs: [
284 "CursorWindow.cpp",
285 ],
286 export_include_dirs: ["include"],
287 target: {
288 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800289 shared_libs: common_test_libs + [
290 "libbinder",
291 "liblog",
292 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600293 },
294 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800295 static_libs: common_test_libs + [
296 "libbinder",
297 "liblog",
298 ],
299 },
300 darwin: {
301 // libbinder is not supported on mac
302 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600303 },
304 },
305}