• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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
17package {
18    default_applicable_licenses: ["frameworks_base_libs_androidfw_license"],
19}
20
21// Added automatically by a large-scale-change
22// See: http://go/android-license-faq
23license {
24    name: "frameworks_base_libs_androidfw_license",
25    visibility: [":__subpackages__"],
26    license_kinds: [
27        "SPDX-license-identifier-Apache-2.0",
28    ],
29    license_text: [
30        "NOTICE",
31    ],
32}
33
34cc_aconfig_library {
35    name: "backup_flags_cc_lib",
36    host_supported: true,
37    aconfig_declarations: "backup_flags",
38}
39
40cc_defaults {
41    name: "libandroidfw_defaults",
42    cpp_std: "gnu++2b",
43    cflags: [
44        "-Werror",
45        "-Wunreachable-code",
46    ],
47    target: {
48        windows: {
49            // The Windows compiler warns incorrectly for value initialization with {}.
50            cppflags: ["-Wno-missing-field-initializers"],
51        },
52        host: {
53            cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
54        },
55    },
56}
57
58cc_library {
59    name: "libandroidfw",
60    defaults: ["libandroidfw_defaults"],
61    host_supported: true,
62    srcs: [
63        "ApkAssets.cpp",
64        "ApkParsing.cpp",
65        "Asset.cpp",
66        "AssetDir.cpp",
67        "AssetManager.cpp",
68        "AssetManager2.cpp",
69        "AssetsProvider.cpp",
70        "AttributeResolution.cpp",
71        "BigBuffer.cpp",
72        "BigBufferStream.cpp",
73        "ChunkIterator.cpp",
74        "ConfigDescription.cpp",
75        "FileStream.cpp",
76        "Idmap.cpp",
77        "LoadedArsc.cpp",
78        "Locale.cpp",
79        "LocaleData.cpp",
80        "misc.cpp",
81        "NinePatch.cpp",
82        "ObbFile.cpp",
83        "PosixUtils.cpp",
84        "Png.cpp",
85        "PngChunkFilter.cpp",
86        "PngCrunch.cpp",
87        "ResourceTimer.cpp",
88        "ResourceTypes.cpp",
89        "ResourceUtils.cpp",
90        "StreamingZipInflater.cpp",
91        "StringPool.cpp",
92        "TypeWrappers.cpp",
93        "Util.cpp",
94        "ZipFileRO.cpp",
95        "ZipUtils.cpp",
96    ],
97    export_include_dirs: ["include"],
98    export_shared_lib_headers: ["libz"],
99    static_libs: [
100        "libincfs-utils",
101        "libpng",
102    ],
103    whole_static_libs: [
104        "libandroidfw_pathutils",
105        "libincfs-utils",
106    ],
107    export_static_lib_headers: ["libincfs-utils"],
108    target: {
109        android: {
110            srcs: [
111                "BackupData.cpp",
112                "BackupHelpers.cpp",
113                "CursorWindow.cpp",
114            ],
115            shared_libs: [
116                "libbase",
117                "libbinder",
118                "liblog",
119                "libcutils",
120                "libincfs",
121                "libutils",
122                "libz",
123            ],
124            static_libs: [
125                "libziparchive_for_incfs",
126                "backup_flags_cc_lib",
127            ],
128            static: {
129                enabled: false,
130            },
131        },
132        host: {
133            shared: {
134                enabled: false,
135            },
136            static_libs: [
137                "libbase",
138                "libcutils",
139                "liblog",
140                "libutils",
141                "libziparchive",
142            ],
143            shared_libs: [
144                "libz",
145            ],
146        },
147        host_linux: {
148            srcs: [
149                "CursorWindow.cpp",
150            ],
151        },
152        windows: {
153            enabled: true,
154        },
155    },
156    sanitize: {
157        blocklist: "libandroidfw_blocklist.txt",
158    },
159}
160
161cc_library_static {
162    name: "libandroidfw_pathutils",
163    defaults: ["libandroidfw_defaults"],
164    host_supported: true,
165    export_include_dirs: ["include_pathutils"],
166    srcs: [
167        "PathUtils.cpp",
168    ],
169    shared_libs: [
170        "libutils",
171    ],
172    target: {
173        windows: {
174            enabled: true,
175        },
176    },
177    visibility: [
178        ":__subpackages__",
179        "//frameworks/base/tools/aapt",
180    ],
181}
182
183common_test_libs = [
184    "libandroidfw",
185    "libbase",
186    "libcutils",
187    "libutils",
188    "libziparchive",
189]
190
191cc_test {
192    name: "libandroidfw_tests",
193    host_supported: true,
194    defaults: ["libandroidfw_defaults"],
195    cppflags: [
196        // This is to suppress warnings/errors from gtest
197        "-Wno-unnamed-type-template-args",
198    ],
199    srcs: [
200        // Helpers/infra for testing.
201        "tests/CommonHelpers.cpp",
202        "tests/TestHelpers.cpp",
203        "tests/TestMain.cpp",
204
205        // Actual tests.
206        "tests/ApkAssets_test.cpp",
207        "tests/ApkParsing_test.cpp",
208        "tests/AppAsLib_test.cpp",
209        "tests/Asset_test.cpp",
210        "tests/AssetManager2_test.cpp",
211        "tests/AttributeFinder_test.cpp",
212        "tests/AttributeResolution_test.cpp",
213        "tests/BigBuffer_test.cpp",
214        "tests/ByteBucketArray_test.cpp",
215        "tests/Config_test.cpp",
216        "tests/ConfigDescription_test.cpp",
217        "tests/ConfigLocale_test.cpp",
218        "tests/DynamicRefTable_test.cpp",
219        "tests/FileStream_test.cpp",
220        "tests/Idmap_test.cpp",
221        "tests/LoadedArsc_test.cpp",
222        "tests/Locale_test.cpp",
223        "tests/NinePatch_test.cpp",
224        "tests/ResourceTimer_test.cpp",
225        "tests/ResourceUtils_test.cpp",
226        "tests/ResTable_test.cpp",
227        "tests/Split_test.cpp",
228        "tests/StringPiece_test.cpp",
229        "tests/StringPool_test.cpp",
230        "tests/Theme_test.cpp",
231        "tests/TypeWrappers_test.cpp",
232        "tests/ZipUtils_test.cpp",
233    ],
234    static_libs: ["libgmock"],
235    target: {
236        android: {
237            srcs: [
238                "tests/BackupData_test.cpp",
239                "tests/BackupHelpers_test.cpp",
240                "tests/CursorWindow_test.cpp",
241                "tests/ObbFile_test.cpp",
242                "tests/PosixUtils_test.cpp",
243            ],
244            shared_libs: common_test_libs + [
245                "libbinder",
246                "liblog",
247                "libui",
248            ],
249        },
250        host: {
251            static_libs: common_test_libs + [
252                "liblog",
253                "libz",
254            ],
255        },
256    },
257    data: [
258        "tests/data/**/*.apk",
259        "tests/data/**/*.arsc",
260        "tests/data/**/*.idmap",
261        ":FrameworkResourcesSparseTestApp",
262        ":FrameworkResourcesNotSparseTestApp",
263    ],
264    test_suites: ["device-tests"],
265}
266
267cc_benchmark {
268    name: "libandroidfw_benchmarks",
269    defaults: ["libandroidfw_defaults"],
270    srcs: [
271        // Helpers/infra for benchmarking.
272        "tests/BenchMain.cpp",
273        "tests/BenchmarkHelpers.cpp",
274        "tests/CommonHelpers.cpp",
275
276        // Actual benchmarks.
277        "tests/AssetManager2_bench.cpp",
278        "tests/AttributeResolution_bench.cpp",
279        "tests/CursorWindow_bench.cpp",
280        "tests/Generic_bench.cpp",
281        "tests/SparseEntry_bench.cpp",
282        "tests/Theme_bench.cpp",
283    ],
284    shared_libs: common_test_libs,
285    data: ["tests/data/**/*.apk"],
286}
287
288cc_library {
289    name: "libandroidfw_fuzzer_lib",
290    defaults: ["libandroidfw_defaults"],
291    host_supported: true,
292    srcs: [
293        "CursorWindow.cpp",
294    ],
295    export_include_dirs: ["include"],
296    target: {
297        android: {
298            shared_libs: common_test_libs + [
299                "libbinder",
300                "liblog",
301            ],
302        },
303        host: {
304            static_libs: common_test_libs + [
305                "libbinder",
306                "liblog",
307            ],
308        },
309        darwin: {
310            // libbinder is not supported on mac
311            enabled: false,
312        },
313    },
314}
315