blob: 5484cf048468bd66661784a9a06687ad081c970c [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 },
101}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700102
103common_test_libs = [
104 "libandroidfw",
105 "libbase",
106 "libcutils",
107 "libutils",
108 "libziparchive",
109]
110
111cc_test {
112 name: "libandroidfw_tests",
113 host_supported: true,
114 defaults: ["libandroidfw_defaults"],
115 cppflags: [
116 // This is to suppress warnings/errors from gtest
117 "-Wno-unnamed-type-template-args",
118 ],
119 srcs: [
120 // Helpers/infra for testing.
121 "tests/CommonHelpers.cpp",
122 "tests/TestHelpers.cpp",
123 "tests/TestMain.cpp",
124
125 // Actual tests.
126 "tests/ApkAssets_test.cpp",
127 "tests/AppAsLib_test.cpp",
128 "tests/Asset_test.cpp",
129 "tests/AssetManager2_test.cpp",
130 "tests/AttributeFinder_test.cpp",
131 "tests/AttributeResolution_test.cpp",
132 "tests/ByteBucketArray_test.cpp",
133 "tests/Config_test.cpp",
134 "tests/ConfigLocale_test.cpp",
135 "tests/Idmap_test.cpp",
136 "tests/LoadedArsc_test.cpp",
137 "tests/ResourceUtils_test.cpp",
138 "tests/ResTable_test.cpp",
139 "tests/Split_test.cpp",
140 "tests/StringPiece_test.cpp",
141 "tests/Theme_test.cpp",
142 "tests/TypeWrappers_test.cpp",
143 "tests/ZipUtils_test.cpp",
144 ],
145 target: {
146 android: {
147 srcs: [
148 "tests/BackupData_test.cpp",
149 "tests/ObbFile_test.cpp",
150 ],
151 shared_libs: common_test_libs + ["libui"],
152 },
153 host: {
154 static_libs: common_test_libs + ["liblog", "libz"],
155 },
156 },
157 data: ["tests/data/**/*.apk"],
158}
159
160cc_benchmark {
161 name: "libandroidfw_benchmarks",
162 defaults: ["libandroidfw_defaults"],
163 srcs: [
164 // Helpers/infra for benchmarking.
165 "tests/BenchMain.cpp",
166 "tests/BenchmarkHelpers.cpp",
167 "tests/CommonHelpers.cpp",
168
169 // Actual benchmarks.
170 "tests/AssetManager2_bench.cpp",
171 "tests/SparseEntry_bench.cpp",
172 "tests/Theme_bench.cpp",
173 ],
174 shared_libs: common_test_libs,
175 data: ["tests/data/**/*.apk"],
176}
177