blob: 86e1fe3d050344e5f57b3ac4e253a55259584aaa [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",
Colin Cross4f8d9e62016-12-01 15:55:00 -080036 cflags: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080037 "-Werror",
Colin Cross4f8d9e62016-12-01 15:55:00 -080038 "-Wunreachable-code",
39 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -070040 target: {
41 windows: {
42 // The Windows compiler warns incorrectly for value initialization with {}.
43 cppflags: ["-Wno-missing-field-initializers"],
44 },
45 host: {
46 cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
47 },
48 },
49}
50
51cc_library {
52 name: "libandroidfw",
53 defaults: ["libandroidfw_defaults"],
54 host_supported: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080055 srcs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -070056 "ApkAssets.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080057 "Asset.cpp",
58 "AssetDir.cpp",
59 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070060 "AssetManager2.cpp",
Ryan Mitchell1a48fa62021-01-10 08:36:36 -080061 "AssetsProvider.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080062 "AttributeResolution.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070063 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020064 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070065 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070066 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020067 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080068 "LocaleData.cpp",
69 "misc.cpp",
70 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020071 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080072 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080073 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080074 "StreamingZipInflater.cpp",
75 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050076 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080077 "ZipFileRO.cpp",
78 "ZipUtils.cpp",
79 ],
80 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070081 export_shared_lib_headers: ["libz"],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000082 static_libs: ["libincfs-utils"],
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +000083 whole_static_libs: [
84 "libandroidfw_pathutils",
85 "libincfs-utils",
86 ],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000087 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080088 target: {
89 android: {
90 srcs: [
91 "BackupData.cpp",
92 "BackupHelpers.cpp",
93 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080094 ],
95 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080096 "libbase",
97 "libbinder",
98 "liblog",
99 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000100 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800101 "libutils",
102 "libz",
103 ],
Yurii Zubrytskyi80d0f4c2021-02-26 03:53:04 -0500104 static_libs: ["libziparchive_for_incfs"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800105 static: {
106 enabled: false,
107 },
108 },
109 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800110 shared: {
111 enabled: false,
112 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700113 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000114 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000115 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000116 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000117 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000118 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700119 ],
120 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700121 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700122 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800123 },
Colin Crosse8f6f0b2022-03-08 18:17:43 -0800124 host_linux: {
Jerome Gaillard10447022020-11-02 16:16:17 +0000125 srcs: [
126 "CursorWindow.cpp",
127 ],
128 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800129 windows: {
130 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800131 },
132 },
Ivan Lozano02828742017-11-07 13:26:27 -0800133 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700134 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800135 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800136}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700137
Tomasz Wasilczyk804e8192023-08-23 02:22:53 +0000138cc_library_static {
139 name: "libandroidfw_pathutils",
140 defaults: ["libandroidfw_defaults"],
141 host_supported: true,
142 export_include_dirs: ["include_pathutils"],
143 srcs: [
144 "PathUtils.cpp",
145 ],
146 shared_libs: [
147 "libutils",
148 ],
149 target: {
150 windows: {
151 enabled: true,
152 },
153 },
154 visibility: [
155 ":__subpackages__",
156 "//frameworks/base/tools/aapt",
157 ],
158}
159
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700160common_test_libs = [
161 "libandroidfw",
162 "libbase",
163 "libcutils",
164 "libutils",
165 "libziparchive",
166]
167
168cc_test {
169 name: "libandroidfw_tests",
170 host_supported: true,
171 defaults: ["libandroidfw_defaults"],
172 cppflags: [
173 // This is to suppress warnings/errors from gtest
174 "-Wno-unnamed-type-template-args",
175 ],
176 srcs: [
177 // Helpers/infra for testing.
178 "tests/CommonHelpers.cpp",
179 "tests/TestHelpers.cpp",
180 "tests/TestMain.cpp",
181
182 // Actual tests.
183 "tests/ApkAssets_test.cpp",
184 "tests/AppAsLib_test.cpp",
185 "tests/Asset_test.cpp",
186 "tests/AssetManager2_test.cpp",
187 "tests/AttributeFinder_test.cpp",
188 "tests/AttributeResolution_test.cpp",
189 "tests/ByteBucketArray_test.cpp",
190 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200191 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700192 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700193 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700194 "tests/Idmap_test.cpp",
195 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200196 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700197 "tests/ResourceUtils_test.cpp",
198 "tests/ResTable_test.cpp",
199 "tests/Split_test.cpp",
200 "tests/StringPiece_test.cpp",
201 "tests/Theme_test.cpp",
202 "tests/TypeWrappers_test.cpp",
203 "tests/ZipUtils_test.cpp",
204 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800205 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700206 target: {
207 android: {
208 srcs: [
209 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600210 "tests/BackupHelpers_test.cpp",
211 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700212 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200213 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700214 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800215 shared_libs: common_test_libs + [
216 "libbinder",
217 "liblog",
218 "libui",
219 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700220 },
221 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800222 static_libs: common_test_libs + [
223 "liblog",
224 "libz",
225 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700226 },
227 },
Winson9947f1e2019-08-16 10:20:39 -0700228 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700229 "tests/data/**/*.apk",
230 "tests/data/**/*.arsc",
231 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700232 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800233 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700234}
235
236cc_benchmark {
237 name: "libandroidfw_benchmarks",
238 defaults: ["libandroidfw_defaults"],
239 srcs: [
240 // Helpers/infra for benchmarking.
241 "tests/BenchMain.cpp",
242 "tests/BenchmarkHelpers.cpp",
243 "tests/CommonHelpers.cpp",
244
245 // Actual benchmarks.
246 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800247 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600248 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700249 "tests/SparseEntry_bench.cpp",
250 "tests/Theme_bench.cpp",
251 ],
252 shared_libs: common_test_libs,
253 data: ["tests/data/**/*.apk"],
254}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600255
256cc_library {
257 name: "libandroidfw_fuzzer_lib",
258 defaults: ["libandroidfw_defaults"],
259 host_supported: true,
260 srcs: [
261 "CursorWindow.cpp",
262 ],
263 export_include_dirs: ["include"],
264 target: {
265 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800266 shared_libs: common_test_libs + [
267 "libbinder",
268 "liblog",
269 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600270 },
271 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800272 static_libs: common_test_libs + [
273 "libbinder",
274 "liblog",
275 ],
276 },
277 darwin: {
278 // libbinder is not supported on mac
279 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600280 },
281 },
282}