blob: aba0f1b476733745d8df8f2db69db33e7801f30f [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"],
83 whole_static_libs: ["libincfs-utils"],
84 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080085 target: {
86 android: {
87 srcs: [
88 "BackupData.cpp",
89 "BackupHelpers.cpp",
90 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080091 ],
92 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080093 "libbase",
94 "libbinder",
95 "liblog",
96 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +000097 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -080098 "libutils",
99 "libz",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000100 "libziparchive",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800101 ],
102 static: {
103 enabled: false,
104 },
105 },
106 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800107 shared: {
108 enabled: false,
109 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700110 static_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000111 "libbase",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000112 "libcutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000113 "liblog",
Ryan Mitchell55ef6162020-11-13 23:55:20 +0000114 "libutils",
Ryan Mitchelldb21f09a2020-11-16 23:08:18 +0000115 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700116 ],
117 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700118 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700119 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800120 },
Jerome Gaillard10447022020-11-02 16:16:17 +0000121 linux_glibc: {
122 srcs: [
123 "CursorWindow.cpp",
124 ],
125 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800126 windows: {
127 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800128 },
129 },
Ivan Lozano02828742017-11-07 13:26:27 -0800130 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700131 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800132 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800133}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700134
135common_test_libs = [
136 "libandroidfw",
137 "libbase",
138 "libcutils",
139 "libutils",
140 "libziparchive",
141]
142
143cc_test {
144 name: "libandroidfw_tests",
145 host_supported: true,
146 defaults: ["libandroidfw_defaults"],
147 cppflags: [
148 // This is to suppress warnings/errors from gtest
149 "-Wno-unnamed-type-template-args",
150 ],
151 srcs: [
152 // Helpers/infra for testing.
153 "tests/CommonHelpers.cpp",
154 "tests/TestHelpers.cpp",
155 "tests/TestMain.cpp",
156
157 // Actual tests.
158 "tests/ApkAssets_test.cpp",
159 "tests/AppAsLib_test.cpp",
160 "tests/Asset_test.cpp",
161 "tests/AssetManager2_test.cpp",
162 "tests/AttributeFinder_test.cpp",
163 "tests/AttributeResolution_test.cpp",
164 "tests/ByteBucketArray_test.cpp",
165 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200166 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700167 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700168 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700169 "tests/Idmap_test.cpp",
170 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200171 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700172 "tests/ResourceUtils_test.cpp",
173 "tests/ResTable_test.cpp",
174 "tests/Split_test.cpp",
175 "tests/StringPiece_test.cpp",
176 "tests/Theme_test.cpp",
177 "tests/TypeWrappers_test.cpp",
178 "tests/ZipUtils_test.cpp",
179 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800180 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700181 target: {
182 android: {
183 srcs: [
184 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600185 "tests/BackupHelpers_test.cpp",
186 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700187 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200188 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700189 ],
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800190 shared_libs: common_test_libs + [
191 "libbinder",
192 "liblog",
193 "libui",
194 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700195 },
196 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800197 static_libs: common_test_libs + [
198 "liblog",
199 "libz",
200 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700201 },
202 },
Winson9947f1e2019-08-16 10:20:39 -0700203 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700204 "tests/data/**/*.apk",
205 "tests/data/**/*.arsc",
206 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700207 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800208 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700209}
210
211cc_benchmark {
212 name: "libandroidfw_benchmarks",
213 defaults: ["libandroidfw_defaults"],
214 srcs: [
215 // Helpers/infra for benchmarking.
216 "tests/BenchMain.cpp",
217 "tests/BenchmarkHelpers.cpp",
218 "tests/CommonHelpers.cpp",
219
220 // Actual benchmarks.
221 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800222 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600223 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700224 "tests/SparseEntry_bench.cpp",
225 "tests/Theme_bench.cpp",
226 ],
227 shared_libs: common_test_libs,
228 data: ["tests/data/**/*.apk"],
229}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600230
231cc_library {
232 name: "libandroidfw_fuzzer_lib",
233 defaults: ["libandroidfw_defaults"],
234 host_supported: true,
235 srcs: [
236 "CursorWindow.cpp",
237 ],
238 export_include_dirs: ["include"],
239 target: {
240 android: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800241 shared_libs: common_test_libs + [
242 "libbinder",
243 "liblog",
244 ],
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600245 },
246 host: {
Brett Chabotde3a2bc2020-11-04 08:59:06 -0800247 static_libs: common_test_libs + [
248 "libbinder",
249 "liblog",
250 ],
251 },
252 darwin: {
253 // libbinder is not supported on mac
254 enabled: false,
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600255 },
256 },
257}