blob: 903ca2aa07836413261d830aab0bc7a3127650a4 [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
Adam Lesinski873ef0e2017-10-11 16:50:37 -070017cc_defaults {
18 name: "libandroidfw_defaults",
Colin Cross4f8d9e62016-12-01 15:55:00 -080019 cflags: [
Colin Cross4f8d9e62016-12-01 15:55:00 -080020 "-Werror",
Colin Cross4f8d9e62016-12-01 15:55:00 -080021 "-Wunreachable-code",
22 ],
Adam Lesinski873ef0e2017-10-11 16:50:37 -070023 target: {
24 windows: {
25 // The Windows compiler warns incorrectly for value initialization with {}.
26 cppflags: ["-Wno-missing-field-initializers"],
27 },
28 host: {
29 cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
30 },
31 },
32}
33
34cc_library {
35 name: "libandroidfw",
36 defaults: ["libandroidfw_defaults"],
37 host_supported: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080038 srcs: [
Adam Lesinski7ad11102016-10-28 16:39:15 -070039 "ApkAssets.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080040 "Asset.cpp",
41 "AssetDir.cpp",
42 "AssetManager.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070043 "AssetManager2.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080044 "AttributeResolution.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070045 "ChunkIterator.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020046 "ConfigDescription.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070047 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070048 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020049 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080050 "LocaleData.cpp",
51 "misc.cpp",
52 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020053 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080054 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080055 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080056 "StreamingZipInflater.cpp",
57 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050058 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080059 "ZipFileRO.cpp",
60 "ZipUtils.cpp",
61 ],
62 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070063 export_shared_lib_headers: ["libz"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080064 target: {
65 android: {
66 srcs: [
67 "BackupData.cpp",
68 "BackupHelpers.cpp",
69 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080070 ],
71 shared_libs: [
Ryan Mitchell55ef6162020-11-13 23:55:20 +000072 "libziparchive",
Colin Cross4f8d9e62016-12-01 15:55:00 -080073 "libbase",
74 "libbinder",
75 "liblog",
76 "libcutils",
Colin Cross4f8d9e62016-12-01 15:55:00 -080077 "libutils",
78 "libz",
79 ],
80 static: {
81 enabled: false,
82 },
83 },
84 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -080085 shared: {
86 enabled: false,
87 },
Adam Lesinski7ad11102016-10-28 16:39:15 -070088 static_libs: [
Ryan Mitchellc75c2e02020-08-17 08:42:48 -070089 "libziparchive",
Ryan Mitchell55ef6162020-11-13 23:55:20 +000090 "libbase",
91 "liblog",
92 "libcutils",
93 "libutils",
Adam Lesinski7ad11102016-10-28 16:39:15 -070094 ],
95 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -070096 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -070097 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -080098 },
99 windows: {
100 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800101 },
102 },
Ivan Lozano02828742017-11-07 13:26:27 -0800103 sanitize: {
Pirama Arumuga Nainar88db3032020-07-28 14:38:20 -0700104 blocklist: "libandroidfw_blocklist.txt",
Ivan Lozano02828742017-11-07 13:26:27 -0800105 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800106}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700107
108common_test_libs = [
109 "libandroidfw",
110 "libbase",
111 "libcutils",
112 "libutils",
113 "libziparchive",
114]
115
116cc_test {
117 name: "libandroidfw_tests",
118 host_supported: true,
119 defaults: ["libandroidfw_defaults"],
120 cppflags: [
121 // This is to suppress warnings/errors from gtest
122 "-Wno-unnamed-type-template-args",
123 ],
124 srcs: [
125 // Helpers/infra for testing.
126 "tests/CommonHelpers.cpp",
127 "tests/TestHelpers.cpp",
128 "tests/TestMain.cpp",
129
130 // Actual tests.
131 "tests/ApkAssets_test.cpp",
132 "tests/AppAsLib_test.cpp",
133 "tests/Asset_test.cpp",
134 "tests/AssetManager2_test.cpp",
135 "tests/AttributeFinder_test.cpp",
136 "tests/AttributeResolution_test.cpp",
137 "tests/ByteBucketArray_test.cpp",
138 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200139 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700140 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700141 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700142 "tests/Idmap_test.cpp",
143 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200144 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700145 "tests/ResourceUtils_test.cpp",
146 "tests/ResTable_test.cpp",
147 "tests/Split_test.cpp",
148 "tests/StringPiece_test.cpp",
149 "tests/Theme_test.cpp",
150 "tests/TypeWrappers_test.cpp",
151 "tests/ZipUtils_test.cpp",
152 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800153 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700154 target: {
155 android: {
156 srcs: [
157 "tests/BackupData_test.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600158 "tests/BackupHelpers_test.cpp",
159 "tests/CursorWindow_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700160 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200161 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700162 ],
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600163 shared_libs: common_test_libs + ["libbinder", "liblog", "libui"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700164 },
165 host: {
166 static_libs: common_test_libs + ["liblog", "libz"],
167 },
168 },
Winson9947f1e2019-08-16 10:20:39 -0700169 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700170 "tests/data/**/*.apk",
171 "tests/data/**/*.arsc",
172 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700173 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800174 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700175}
176
177cc_benchmark {
178 name: "libandroidfw_benchmarks",
179 defaults: ["libandroidfw_defaults"],
180 srcs: [
181 // Helpers/infra for benchmarking.
182 "tests/BenchMain.cpp",
183 "tests/BenchmarkHelpers.cpp",
184 "tests/CommonHelpers.cpp",
185
186 // Actual benchmarks.
187 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800188 "tests/AttributeResolution_bench.cpp",
Jeff Sharkeyae2d88a2020-09-26 18:57:32 -0600189 "tests/CursorWindow_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700190 "tests/SparseEntry_bench.cpp",
191 "tests/Theme_bench.cpp",
192 ],
193 shared_libs: common_test_libs,
194 data: ["tests/data/**/*.apk"],
195}
Jeff Sharkey256da5a2020-10-13 09:40:52 -0600196
197cc_library {
198 name: "libandroidfw_fuzzer_lib",
199 defaults: ["libandroidfw_defaults"],
200 host_supported: true,
201 srcs: [
202 "CursorWindow.cpp",
203 ],
204 export_include_dirs: ["include"],
205 target: {
206 android: {
207 shared_libs: common_test_libs + ["libbinder", "liblog"],
208 },
209 host: {
210 static_libs: common_test_libs + ["libbinder", "liblog"],
211 },
212 },
213}