blob: 70d52164ff7489730b04d3725101d07dab7730eb [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"],
60 target: {
61 android: {
62 srcs: [
63 "BackupData.cpp",
64 "BackupHelpers.cpp",
65 "CursorWindow.cpp",
66 "DisplayEventDispatcher.cpp",
67 ],
68 shared_libs: [
69 "libziparchive",
70 "libbase",
71 "libbinder",
72 "liblog",
73 "libcutils",
74 "libgui",
75 "libutils",
76 "libz",
77 ],
78 static: {
79 enabled: false,
80 },
81 },
82 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -080083 shared: {
84 enabled: false,
85 },
Adam Lesinski7ad11102016-10-28 16:39:15 -070086 static_libs: [
87 "libziparchive",
88 "libbase",
89 "liblog",
90 "libcutils",
91 "libutils",
92 ],
93 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -070094 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -070095 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -080096 },
97 windows: {
98 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -080099 },
100 },
Ivan Lozano02828742017-11-07 13:26:27 -0800101 sanitize: {
102 blacklist: "libandroidfw_blacklist.txt",
103 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800104}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700105
106common_test_libs = [
107 "libandroidfw",
108 "libbase",
109 "libcutils",
110 "libutils",
111 "libziparchive",
112]
113
114cc_test {
115 name: "libandroidfw_tests",
116 host_supported: true,
117 defaults: ["libandroidfw_defaults"],
118 cppflags: [
119 // This is to suppress warnings/errors from gtest
120 "-Wno-unnamed-type-template-args",
121 ],
122 srcs: [
123 // Helpers/infra for testing.
124 "tests/CommonHelpers.cpp",
125 "tests/TestHelpers.cpp",
126 "tests/TestMain.cpp",
127
128 // Actual tests.
129 "tests/ApkAssets_test.cpp",
130 "tests/AppAsLib_test.cpp",
131 "tests/Asset_test.cpp",
132 "tests/AssetManager2_test.cpp",
133 "tests/AttributeFinder_test.cpp",
134 "tests/AttributeResolution_test.cpp",
135 "tests/ByteBucketArray_test.cpp",
136 "tests/Config_test.cpp",
137 "tests/ConfigLocale_test.cpp",
138 "tests/Idmap_test.cpp",
139 "tests/LoadedArsc_test.cpp",
140 "tests/ResourceUtils_test.cpp",
141 "tests/ResTable_test.cpp",
142 "tests/Split_test.cpp",
143 "tests/StringPiece_test.cpp",
144 "tests/Theme_test.cpp",
145 "tests/TypeWrappers_test.cpp",
146 "tests/ZipUtils_test.cpp",
147 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800148 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700149 target: {
150 android: {
151 srcs: [
152 "tests/BackupData_test.cpp",
153 "tests/ObbFile_test.cpp",
154 ],
155 shared_libs: common_test_libs + ["libui"],
156 },
157 host: {
158 static_libs: common_test_libs + ["liblog", "libz"],
159 },
160 },
161 data: ["tests/data/**/*.apk"],
162}
163
164cc_benchmark {
165 name: "libandroidfw_benchmarks",
166 defaults: ["libandroidfw_defaults"],
167 srcs: [
168 // Helpers/infra for benchmarking.
169 "tests/BenchMain.cpp",
170 "tests/BenchmarkHelpers.cpp",
171 "tests/CommonHelpers.cpp",
172
173 // Actual benchmarks.
174 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800175 "tests/AttributeResolution_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700176 "tests/SparseEntry_bench.cpp",
177 "tests/Theme_bench.cpp",
178 ],
179 shared_libs: common_test_libs,
180 data: ["tests/data/**/*.apk"],
181}
182