blob: 779c4b75efc457db01a8d23f5c8068590b97b3a5 [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",
Colin Cross4f8d9e62016-12-01 15:55:00 -080058 "Asset.cpp",
59 "AssetDir.cpp",
60 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070061 "AssetManager2.cpp",
Ryan Mitchell1a48fa62021-01-10 08:36:36 -080062 "AssetsProvider.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080063 "AttributeResolution.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000064 "BigBuffer.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070065 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020066 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070067 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070068 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020069 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080070 "LocaleData.cpp",
71 "misc.cpp",
72 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020073 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080074 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080075 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080076 "StreamingZipInflater.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +000077 "StringPool.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080078 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050079 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080080 "ZipFileRO.cpp",
81 "ZipUtils.cpp",
82 ],
83 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070084 export_shared_lib_headers: ["libz"],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000085 static_libs: ["libincfs-utils"],
86 whole_static_libs: ["libincfs-utils"],
87 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
138common_test_libs = [
139 "libandroidfw",
140 "libbase",
141 "libcutils",
142 "libutils",
143 "libziparchive",
144]
145
146cc_test {
147 name: "libandroidfw_tests",
148 host_supported: true,
149 defaults: ["libandroidfw_defaults"],
150 cppflags: [
151 // This is to suppress warnings/errors from gtest
152 "-Wno-unnamed-type-template-args",
153 ],
154 srcs: [
155 // Helpers/infra for testing.
156 "tests/CommonHelpers.cpp",
157 "tests/TestHelpers.cpp",
158 "tests/TestMain.cpp",
159
160 // Actual tests.
161 "tests/ApkAssets_test.cpp",
162 "tests/AppAsLib_test.cpp",
163 "tests/Asset_test.cpp",
164 "tests/AssetManager2_test.cpp",
165 "tests/AttributeFinder_test.cpp",
166 "tests/AttributeResolution_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000167 "tests/BigBuffer_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700168 "tests/ByteBucketArray_test.cpp",
169 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200170 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700171 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700172 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700173 "tests/Idmap_test.cpp",
174 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200175 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700176 "tests/ResourceUtils_test.cpp",
177 "tests/ResTable_test.cpp",
178 "tests/Split_test.cpp",
179 "tests/StringPiece_test.cpp",
Jeremy Meyer56f36e82022-05-20 20:35:42 +0000180 "tests/StringPool_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700181 "tests/Theme_test.cpp",
182 "tests/TypeWrappers_test.cpp",
183 "tests/ZipUtils_test.cpp",
184 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800185 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700186 target: {
187 android: {
188 srcs: [
189 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600190 "tests/BackupHelpers_test.cpp",
191 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700192 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200193 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700194 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800195 shared_libs: common_test_libs + [
196 "libbinder",
197 "liblog",
198 "libui",
199 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700200 },
201 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800202 static_libs: common_test_libs + [
203 "liblog",
204 "libz",
205 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700206 },
207 },
Winson9947f1e2019-08-16 10:20:39 -0700208 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700209 "tests/data/**/*.apk",
210 "tests/data/**/*.arsc",
211 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700212 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800213 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700214}
215
216cc_benchmark {
217 name: "libandroidfw_benchmarks",
218 defaults: ["libandroidfw_defaults"],
219 srcs: [
220 // Helpers/infra for benchmarking.
221 "tests/BenchMain.cpp",
222 "tests/BenchmarkHelpers.cpp",
223 "tests/CommonHelpers.cpp",
224
225 // Actual benchmarks.
226 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800227 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600228 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700229 "tests/SparseEntry_bench.cpp",
230 "tests/Theme_bench.cpp",
231 ],
232 shared_libs: common_test_libs,
233 data: ["tests/data/**/*.apk"],
234}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600235
236cc_library {
237 name: "libandroidfw_fuzzer_lib",
238 defaults: ["libandroidfw_defaults"],
239 host_supported: true,
240 srcs: [
241 "CursorWindow.cpp",
242 ],
243 export_include_dirs: ["include"],
244 target: {
245 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800246 shared_libs: common_test_libs + [
247 "libbinder",
248 "liblog",
249 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600250 },
251 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800252 static_libs: common_test_libs + [
253 "libbinder",
254 "liblog",
255 ],
256 },
257 darwin: {
258 // libbinder is not supported on mac
259 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600260 },
261 },
262}