blob: 8a379d58153263ef70a0c6304cdd6762eea4dfe6 [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",
Adam Lesinski7ad11102016-10-28 16:39:15 -070064 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020065 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070066 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070067 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020068 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080069 "LocaleData.cpp",
70 "misc.cpp",
71 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020072 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080073 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080074 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080075 "StreamingZipInflater.cpp",
76 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050077 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080078 "ZipFileRO.cpp",
79 "ZipUtils.cpp",
80 ],
81 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070082 export_shared_lib_headers: ["libz"],
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000083 static_libs: ["libincfs-utils"],
84 whole_static_libs: ["libincfs-utils"],
85 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080086 target: {
87 android: {
88 srcs: [
89 "BackupData.cpp",
90 "BackupHelpers.cpp",
91 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080092 ],
93 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080094 "libbase",
95 "libbinder",
96 "liblog",
97 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000098 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -080099 "libutils",
100 "libz",
101 ],
Yurii Zubrytskyi80d0f4c2021-02-26 03:53:04 -0500102 static_libs: ["libziparchive_for_incfs"],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800103 static: {
104 enabled: false,
105 },
106 },
107 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800108 shared: {
109 enabled: false,
110 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700111 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000112 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000113 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000114 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000115 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000116 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700117 ],
118 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700119 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700120 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800121 },
Colin Crosse8f6f0b2022-03-08 18:17:43 -0800122 host_linux: {
Jerome Gaillard10447022020-11-02 16:16:17 +0000123 srcs: [
124 "CursorWindow.cpp",
125 ],
126 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800127 windows: {
128 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800129 },
130 },
Ivan Lozano02828742017-11-07 13:26:27 -0800131 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700132 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800133 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800134}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700135
136common_test_libs = [
137 "libandroidfw",
138 "libbase",
139 "libcutils",
140 "libutils",
141 "libziparchive",
142]
143
144cc_test {
145 name: "libandroidfw_tests",
146 host_supported: true,
147 defaults: ["libandroidfw_defaults"],
148 cppflags: [
149 // This is to suppress warnings/errors from gtest
150 "-Wno-unnamed-type-template-args",
151 ],
152 srcs: [
153 // Helpers/infra for testing.
154 "tests/CommonHelpers.cpp",
155 "tests/TestHelpers.cpp",
156 "tests/TestMain.cpp",
157
158 // Actual tests.
159 "tests/ApkAssets_test.cpp",
160 "tests/AppAsLib_test.cpp",
161 "tests/Asset_test.cpp",
162 "tests/AssetManager2_test.cpp",
163 "tests/AttributeFinder_test.cpp",
164 "tests/AttributeResolution_test.cpp",
165 "tests/ByteBucketArray_test.cpp",
166 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200167 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700168 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700169 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700170 "tests/Idmap_test.cpp",
171 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200172 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700173 "tests/ResourceUtils_test.cpp",
174 "tests/ResTable_test.cpp",
175 "tests/Split_test.cpp",
176 "tests/StringPiece_test.cpp",
177 "tests/Theme_test.cpp",
178 "tests/TypeWrappers_test.cpp",
179 "tests/ZipUtils_test.cpp",
180 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800181 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700182 target: {
183 android: {
184 srcs: [
185 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600186 "tests/BackupHelpers_test.cpp",
187 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700188 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200189 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700190 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800191 shared_libs: common_test_libs + [
192 "libbinder",
193 "liblog",
194 "libui",
195 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700196 },
197 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800198 static_libs: common_test_libs + [
199 "liblog",
200 "libz",
201 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700202 },
203 },
Winson9947f1e2019-08-16 10:20:39 -0700204 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700205 "tests/data/**/*.apk",
206 "tests/data/**/*.arsc",
207 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700208 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800209 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700210}
211
212cc_benchmark {
213 name: "libandroidfw_benchmarks",
214 defaults: ["libandroidfw_defaults"],
215 srcs: [
216 // Helpers/infra for benchmarking.
217 "tests/BenchMain.cpp",
218 "tests/BenchmarkHelpers.cpp",
219 "tests/CommonHelpers.cpp",
220
221 // Actual benchmarks.
222 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800223 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600224 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700225 "tests/SparseEntry_bench.cpp",
226 "tests/Theme_bench.cpp",
227 ],
228 shared_libs: common_test_libs,
229 data: ["tests/data/**/*.apk"],
230}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600231
232cc_library {
233 name: "libandroidfw_fuzzer_lib",
234 defaults: ["libandroidfw_defaults"],
235 host_supported: true,
236 srcs: [
237 "CursorWindow.cpp",
238 ],
239 export_include_dirs: ["include"],
240 target: {
241 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800242 shared_libs: common_test_libs + [
243 "libbinder",
244 "liblog",
245 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600246 },
247 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800248 static_libs: common_test_libs + [
249 "libbinder",
250 "liblog",
251 ],
252 },
253 darwin: {
254 // libbinder is not supported on mac
255 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600256 },
257 },
258}