blob: 3f2f3495ae8f1b023098558608fa4f36b5933d52 [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",
Ryan Mitchellfe50d732019-12-19 16:12:35 -080047 "DynamicLibManager.cpp",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070048 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070049 "LoadedArsc.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +020050 "Locale.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080051 "LocaleData.cpp",
52 "misc.cpp",
53 "ObbFile.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +020054 "PosixUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080055 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080056 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080057 "StreamingZipInflater.cpp",
58 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050059 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080060 "ZipFileRO.cpp",
61 "ZipUtils.cpp",
62 ],
63 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070064 export_shared_lib_headers: ["libz"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080065 target: {
66 android: {
67 srcs: [
68 "BackupData.cpp",
69 "BackupHelpers.cpp",
70 "CursorWindow.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080071 ],
72 shared_libs: [
73 "libziparchive",
74 "libbase",
75 "libbinder",
76 "liblog",
77 "libcutils",
Colin Cross4f8d9e62016-12-01 15:55:00 -080078 "libutils",
79 "libz",
80 ],
81 static: {
82 enabled: false,
83 },
84 },
85 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -080086 shared: {
87 enabled: false,
88 },
Adam Lesinski7ad11102016-10-28 16:39:15 -070089 static_libs: [
90 "libziparchive",
91 "libbase",
92 "liblog",
93 "libcutils",
94 "libutils",
95 ],
96 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -070097 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -070098 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -080099 },
100 windows: {
101 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800102 },
103 },
Ivan Lozano02828742017-11-07 13:26:27 -0800104 sanitize: {
105 blacklist: "libandroidfw_blacklist.txt",
106 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800107}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700108
109common_test_libs = [
110 "libandroidfw",
111 "libbase",
112 "libcutils",
113 "libutils",
114 "libziparchive",
115]
116
117cc_test {
118 name: "libandroidfw_tests",
119 host_supported: true,
120 defaults: ["libandroidfw_defaults"],
121 cppflags: [
122 // This is to suppress warnings/errors from gtest
123 "-Wno-unnamed-type-template-args",
124 ],
125 srcs: [
126 // Helpers/infra for testing.
127 "tests/CommonHelpers.cpp",
128 "tests/TestHelpers.cpp",
129 "tests/TestMain.cpp",
130
131 // Actual tests.
132 "tests/ApkAssets_test.cpp",
133 "tests/AppAsLib_test.cpp",
134 "tests/Asset_test.cpp",
135 "tests/AssetManager2_test.cpp",
136 "tests/AttributeFinder_test.cpp",
137 "tests/AttributeResolution_test.cpp",
138 "tests/ByteBucketArray_test.cpp",
139 "tests/Config_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200140 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700141 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700142 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700143 "tests/Idmap_test.cpp",
144 "tests/LoadedArsc_test.cpp",
Mårten Kongstad24c9aa62018-06-20 08:46:41 +0200145 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700146 "tests/ResourceUtils_test.cpp",
147 "tests/ResTable_test.cpp",
148 "tests/Split_test.cpp",
149 "tests/StringPiece_test.cpp",
150 "tests/Theme_test.cpp",
151 "tests/TypeWrappers_test.cpp",
152 "tests/ZipUtils_test.cpp",
153 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800154 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700155 target: {
156 android: {
157 srcs: [
158 "tests/BackupData_test.cpp",
159 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200160 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700161 ],
162 shared_libs: common_test_libs + ["libui"],
163 },
164 host: {
165 static_libs: common_test_libs + ["liblog", "libz"],
166 },
167 },
Winson9947f1e2019-08-16 10:20:39 -0700168 data: [
Ryan Mitchell8a891d82019-07-01 09:48:23 -0700169 "tests/data/**/*.apk",
170 "tests/data/**/*.arsc",
171 "tests/data/**/*.idmap",
Winson9947f1e2019-08-16 10:20:39 -0700172 ],
Dan Shi8d7267e2018-12-18 16:06:40 -0800173 test_suites: ["device-tests"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700174}
175
176cc_benchmark {
177 name: "libandroidfw_benchmarks",
178 defaults: ["libandroidfw_defaults"],
179 srcs: [
180 // Helpers/infra for benchmarking.
181 "tests/BenchMain.cpp",
182 "tests/BenchmarkHelpers.cpp",
183 "tests/CommonHelpers.cpp",
184
185 // Actual benchmarks.
186 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800187 "tests/AttributeResolution_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700188 "tests/SparseEntry_bench.cpp",
189 "tests/Theme_bench.cpp",
190 ],
191 shared_libs: common_test_libs,
192 data: ["tests/data/**/*.apk"],
193}
194