blob: 0c32fdf5baf542355752735833ec00fadd9ad7e4 [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 Kongstad5c541f62018-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 Kongstad5c541f62018-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 ],
Chih-Hung Hsiehe8abd062018-10-22 09:56:12 -070062 // Allow implicit fallthroughs in Locale.cpp and ResourceTypes.cpp until they are fixed.
63 cflags: ["-Wno-implicit-fallthrough"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080064 export_include_dirs: ["include"],
Dan Willemsen4888b1f2018-05-09 20:30:33 -070065 export_shared_lib_headers: ["libz"],
Colin Cross4f8d9e62016-12-01 15:55:00 -080066 target: {
67 android: {
68 srcs: [
69 "BackupData.cpp",
70 "BackupHelpers.cpp",
71 "CursorWindow.cpp",
72 "DisplayEventDispatcher.cpp",
73 ],
74 shared_libs: [
75 "libziparchive",
76 "libbase",
77 "libbinder",
78 "liblog",
79 "libcutils",
80 "libgui",
81 "libutils",
82 "libz",
83 ],
84 static: {
85 enabled: false,
86 },
87 },
88 host: {
Colin Cross4f8d9e62016-12-01 15:55:00 -080089 shared: {
90 enabled: false,
91 },
Adam Lesinski7ad11102016-10-28 16:39:15 -070092 static_libs: [
93 "libziparchive",
94 "libbase",
95 "liblog",
96 "libcutils",
97 "libutils",
98 ],
99 shared_libs: [
Dan Willemsena2902e32017-09-27 16:20:31 -0700100 "libz",
Adam Lesinski7ad11102016-10-28 16:39:15 -0700101 ],
Colin Cross4f8d9e62016-12-01 15:55:00 -0800102 },
103 windows: {
104 enabled: true,
Colin Cross4f8d9e62016-12-01 15:55:00 -0800105 },
106 },
Ivan Lozano02828742017-11-07 13:26:27 -0800107 sanitize: {
108 blacklist: "libandroidfw_blacklist.txt",
109 },
Colin Cross4f8d9e62016-12-01 15:55:00 -0800110}
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700111
112common_test_libs = [
113 "libandroidfw",
114 "libbase",
115 "libcutils",
116 "libutils",
117 "libziparchive",
118]
119
120cc_test {
121 name: "libandroidfw_tests",
122 host_supported: true,
123 defaults: ["libandroidfw_defaults"],
124 cppflags: [
125 // This is to suppress warnings/errors from gtest
126 "-Wno-unnamed-type-template-args",
127 ],
128 srcs: [
129 // Helpers/infra for testing.
130 "tests/CommonHelpers.cpp",
131 "tests/TestHelpers.cpp",
132 "tests/TestMain.cpp",
133
134 // Actual tests.
135 "tests/ApkAssets_test.cpp",
136 "tests/AppAsLib_test.cpp",
137 "tests/Asset_test.cpp",
138 "tests/AssetManager2_test.cpp",
139 "tests/AttributeFinder_test.cpp",
140 "tests/AttributeResolution_test.cpp",
141 "tests/ByteBucketArray_test.cpp",
142 "tests/Config_test.cpp",
Mårten Kongstad5c541f62018-06-20 08:46:41 +0200143 "tests/ConfigDescription_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700144 "tests/ConfigLocale_test.cpp",
145 "tests/Idmap_test.cpp",
146 "tests/LoadedArsc_test.cpp",
Mårten Kongstad5c541f62018-06-20 08:46:41 +0200147 "tests/Locale_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700148 "tests/ResourceUtils_test.cpp",
149 "tests/ResTable_test.cpp",
150 "tests/Split_test.cpp",
151 "tests/StringPiece_test.cpp",
152 "tests/Theme_test.cpp",
153 "tests/TypeWrappers_test.cpp",
154 "tests/ZipUtils_test.cpp",
155 ],
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800156 static_libs: ["libgmock"],
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700157 target: {
158 android: {
159 srcs: [
160 "tests/BackupData_test.cpp",
161 "tests/ObbFile_test.cpp",
Mårten Kongstad2503a492018-09-27 13:32:30 +0200162 "tests/PosixUtils_test.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700163 ],
164 shared_libs: common_test_libs + ["libui"],
165 },
166 host: {
167 static_libs: common_test_libs + ["liblog", "libz"],
168 },
169 },
170 data: ["tests/data/**/*.apk"],
171}
172
173cc_benchmark {
174 name: "libandroidfw_benchmarks",
175 defaults: ["libandroidfw_defaults"],
176 srcs: [
177 // Helpers/infra for benchmarking.
178 "tests/BenchMain.cpp",
179 "tests/BenchmarkHelpers.cpp",
180 "tests/CommonHelpers.cpp",
181
182 // Actual benchmarks.
183 "tests/AssetManager2_bench.cpp",
Adam Lesinskibebfcc42018-02-12 14:27:46 -0800184 "tests/AttributeResolution_bench.cpp",
Adam Lesinski873ef0e2017-10-11 16:50:37 -0700185 "tests/SparseEntry_bench.cpp",
186 "tests/Theme_bench.cpp",
187 ],
188 shared_libs: common_test_libs,
189 data: ["tests/data/**/*.apk"],
190}
191