blob: 581af0d0628a9dd25598ac1b7504c72fe8c62f5d [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 Badour051ef782021-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",
Colin Cross4f8d9e62016-12-01 15:55:00 -080061 "AttributeResolution.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070062 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020063 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070064 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070065 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020066 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080067 "LocaleData.cpp",
68 "misc.cpp",
69 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020070 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080071 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080072 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080073 "StreamingZipInflater.cpp",
74 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050075 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080076 "ZipFileRO.cpp",
77 "ZipUtils.cpp",
78 ],
79 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070080 export_shared_lib_headers: ["libz"],
Ryan Mitchell80094e32020-11-16 23:08:18 +000081 static_libs: ["libincfs-utils"],
82 whole_static_libs: ["libincfs-utils"],
83 export_static_lib_headers: ["libincfs-utils"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080084 target: {
85 android: {
86 srcs: [
87 "BackupData.cpp",
88 "BackupHelpers.cpp",
89 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080090 ],
91 shared_libs: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080092 "libbase",
93 "libbinder",
94 "liblog",
95 "libcutils",
Ryan Mitchell80094e32020-11-16 23:08:18 +000096 "libincfs",
Colin Cross4f8d9e62016-12-01 15:55:00 -080097 "libutils",
98 "libz",
Ryan Mitchell80094e32020-11-16 23:08:18 +000099 "libziparchive",
Colin Cross4f8d9e62016-12-01 15:55:00 -0800100 ],
101 static: {
102 enabled: false,
103 },
104 },
105 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -0800106 shared: {
107 enabled: false,
108 },
Adam Lesinski7ad11102016-10-28 16:39:15 -0700109 static_libs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -0700110 "libbase",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700111 "libcutils",
Ryan Mitchell80094e32020-11-16 23:08:18 +0000112 "liblog",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700113 "libutils",
Ryan Mitchell80094e32020-11-16 23:08:18 +0000114 "libziparchive",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700115 ],
116 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700117 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700118 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800119 },
120 windows: {
121 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800122 },
123 },
Ivan Lozano02828742017-11-07 13:26:27 -0800124 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700125 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800126 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800127}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700128
129common_test_libs = [
130 "libandroidfw",
131 "libbase",
132 "libcutils",
133 "libutils",
134 "libziparchive",
135]
136
137cc_test {
138 name: "libandroidfw_tests",
139 host_supported: true,
140 defaults: ["libandroidfw_defaults"],
141 cppflags: [
142 // This is to suppress warnings/errors from gtest
143 "-Wno-unnamed-type-template-args",
144 ],
145 srcs: [
146 // Helpers/infra for testing.
147 "tests/CommonHelpers.cpp",
148 "tests/TestHelpers.cpp",
149 "tests/TestMain.cpp",
150
151 // Actual tests.
152 "tests/ApkAssets_test.cpp",
153 "tests/AppAsLib_test.cpp",
154 "tests/Asset_test.cpp",
155 "tests/AssetManager2_test.cpp",
156 "tests/AttributeFinder_test.cpp",
157 "tests/AttributeResolution_test.cpp",
158 "tests/ByteBucketArray_test.cpp",
159 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200160 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700161 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700162 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700163 "tests/Idmap_test.cpp",
164 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200165 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700166 "tests/ResourceUtils_test.cpp",
167 "tests/ResTable_test.cpp",
168 "tests/Split_test.cpp",
169 "tests/StringPiece_test.cpp",
170 "tests/Theme_test.cpp",
171 "tests/TypeWrappers_test.cpp",
172 "tests/ZipUtils_test.cpp",
173 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800174 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700175 target: {
176 android: {
177 srcs: [
178 "tests/BackupData_test.cpp",
179 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200180 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700181 ],
182 shared_libs: common_test_libs + ["libui"],
183 },
184 host: {
185 static_libs: common_test_libs + ["liblog", "libz"],
186 },
187 },
Winson9947f1e2019-08-16 10:20:39 -0700188 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700189 "tests/data/**/*.apk",
190 "tests/data/**/*.arsc",
191 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700192 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800193 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700194}
195
196cc_benchmark {
197 name: "libandroidfw_benchmarks",
198 defaults: ["libandroidfw_defaults"],
199 srcs: [
200 // Helpers/infra for benchmarking.
201 "tests/BenchMain.cpp",
202 "tests/BenchmarkHelpers.cpp",
203 "tests/CommonHelpers.cpp",
204
205 // Actual benchmarks.
206 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800207 "tests/AttributeResolution_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700208 "tests/SparseEntry_bench.cpp",
209 "tests/Theme_bench.cpp",
210 ],
211 shared_libs: common_test_libs,
212 data: ["tests/data/**/*.apk"],
213}