blob: bba36bcba8042ad35843f388dfb366af84088ef6 [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",
Adam Lesinski970bd8d2017-09-25 13:21:55 -070046 "Idmap.cpp",
Adam Lesinski7ad11102016-10-28 16:39:15 -070047 "LoadedArsc.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080048 "LocaleData.cpp",
49 "misc.cpp",
50 "ObbFile.cpp",
51 "ResourceTypes.cpp",
Adam Lesinski929d6512017-01-16 19:11:19 -080052 "ResourceUtils.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080053 "StreamingZipInflater.cpp",
54 "TypeWrappers.cpp",
Adam Lesinskida431a22016-12-29 16:08:16 -050055 "Util.cpp",
Colin Cross4f8d9e62016-12-01 15:55:00 -080056 "ZipFileRO.cpp",
57 "ZipUtils.cpp",
58 ],
59 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070060 export_shared_lib_headers: ["libz"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080061 target: {
62 android: {
63 srcs: [
64 "BackupData.cpp",
65 "BackupHelpers.cpp",
66 "CursorWindow.cpp",
67 "DisplayEventDispatcher.cpp",
68 ],
69 shared_libs: [
70 "libziparchive",
71 "libbase",
72 "libbinder",
73 "liblog",
74 "libcutils",
75 "libgui",
76 "libutils",
77 "libz",
78 ],
79 static: {
80 enabled: false,
81 },
82 },
83 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -080084 shared: {
85 enabled: false,
86 },
Adam Lesinski7ad11102016-10-28 16:39:15 -070087 static_libs: [
88 "libziparchive",
89 "libbase",
90 "liblog",
91 "libcutils",
92 "libutils",
93 ],
94 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -070095 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -070096 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -080097 },
98 windows: {
99 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800100 },
101 },
Ivan Lozano02828742017-11-07 13:26:27 -0800102 sanitize: {
103 blacklist: "libandroidfw_blacklist.txt",
104 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800105}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700106
107common_test_libs = [
108 "libandroidfw",
109 "libbase",
110 "libcutils",
111 "libutils",
112 "libziparchive",
113]
114
115cc_test {
116 name: "libandroidfw_tests",
117 host_supported: true,
118 defaults: ["libandroidfw_defaults"],
119 cppflags: [
120 // This is to suppress warnings/errors from gtest
121 "-Wno-unnamed-type-template-args",
122 ],
123 srcs: [
124 // Helpers/infra for testing.
125 "tests/CommonHelpers.cpp",
126 "tests/TestHelpers.cpp",
127 "tests/TestMain.cpp",
128
129 // Actual tests.
130 "tests/ApkAssets_test.cpp",
131 "tests/AppAsLib_test.cpp",
132 "tests/Asset_test.cpp",
133 "tests/AssetManager2_test.cpp",
134 "tests/AttributeFinder_test.cpp",
135 "tests/AttributeResolution_test.cpp",
136 "tests/ByteBucketArray_test.cpp",
137 "tests/Config_test.cpp",
138 "tests/ConfigLocale_test.cpp",
Ryan Mitchellb9b540b2018-08-22 11:22:54 -0700139 "tests/DynamicRefTable_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700140 "tests/Idmap_test.cpp",
141 "tests/LoadedArsc_test.cpp",
142 "tests/ResourceUtils_test.cpp",
143 "tests/ResTable_test.cpp",
144 "tests/Split_test.cpp",
145 "tests/StringPiece_test.cpp",
146 "tests/Theme_test.cpp",
147 "tests/TypeWrappers_test.cpp",
148 "tests/ZipUtils_test.cpp",
149 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800150 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700151 target: {
152 android: {
153 srcs: [
154 "tests/BackupData_test.cpp",
155 "tests/ObbFile_test.cpp",
156 ],
157 shared_libs: common_test_libs + ["libui"],
158 },
159 host: {
160 static_libs: common_test_libs + ["liblog", "libz"],
161 },
162 },
163 data: ["tests/data/**/*.apk"],
164}
165
166cc_benchmark {
167 name: "libandroidfw_benchmarks",
168 defaults: ["libandroidfw_defaults"],
169 srcs: [
170 // Helpers/infra for benchmarking.
171 "tests/BenchMain.cpp",
172 "tests/BenchmarkHelpers.cpp",
173 "tests/CommonHelpers.cpp",
174
175 // Actual benchmarks.
176 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800177 "tests/AttributeResolution_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700178 "tests/SparseEntry_bench.cpp",
179 "tests/Theme_bench.cpp",
180 ],
181 shared_libs: common_test_libs,
182 data: ["tests/data/**/*.apk"],
183}
184