• 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
17cc_defaults {
18    name: "libandroidfw_defaults",
19    cflags: [
20        "-Werror",
21        "-Wunreachable-code",
22    ],
23    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,
38    srcs: [
39        "ApkAssets.cpp",
40        "Asset.cpp",
41        "AssetDir.cpp",
42        "AssetManager.cpp",
43        "AssetManager2.cpp",
44        "AttributeResolution.cpp",
45        "ChunkIterator.cpp",
46        "ConfigDescription.cpp",
47        "Idmap.cpp",
48        "LoadedArsc.cpp",
49        "Locale.cpp",
50        "LocaleData.cpp",
51        "misc.cpp",
52        "ObbFile.cpp",
53        "PosixUtils.cpp",
54        "ResourceTypes.cpp",
55        "ResourceUtils.cpp",
56        "StreamingZipInflater.cpp",
57        "TypeWrappers.cpp",
58        "Util.cpp",
59        "ZipFileRO.cpp",
60        "ZipUtils.cpp",
61    ],
62    export_include_dirs: ["include"],
63    export_shared_lib_headers: ["libz"],
64    target: {
65        android: {
66            srcs: [
67                "BackupData.cpp",
68                "BackupHelpers.cpp",
69                "CursorWindow.cpp",
70            ],
71            shared_libs: [
72                "libziparchive",
73                "libbase",
74                "libbinder",
75                "liblog",
76                "libcutils",
77                "libutils",
78                "libz",
79            ],
80            static: {
81                enabled: false,
82            },
83        },
84        host: {
85            shared: {
86                enabled: false,
87            },
88            static_libs: [
89                "libziparchive",
90                "libbase",
91                "liblog",
92                "libcutils",
93                "libutils",
94            ],
95            shared_libs: [
96                "libz",
97            ],
98        },
99        windows: {
100            enabled: true,
101        },
102    },
103    sanitize: {
104        blacklist: "libandroidfw_blacklist.txt",
105    },
106}
107
108common_test_libs = [
109    "libandroidfw",
110    "libbase",
111    "libcutils",
112    "libutils",
113    "libziparchive",
114]
115
116cc_test {
117    name: "libandroidfw_tests",
118    host_supported: true,
119    defaults: ["libandroidfw_defaults"],
120    cppflags: [
121        // This is to suppress warnings/errors from gtest
122        "-Wno-unnamed-type-template-args",
123    ],
124    srcs: [
125        // Helpers/infra for testing.
126        "tests/CommonHelpers.cpp",
127        "tests/TestHelpers.cpp",
128        "tests/TestMain.cpp",
129
130        // Actual tests.
131        "tests/ApkAssets_test.cpp",
132        "tests/AppAsLib_test.cpp",
133        "tests/Asset_test.cpp",
134        "tests/AssetManager2_test.cpp",
135        "tests/AttributeFinder_test.cpp",
136        "tests/AttributeResolution_test.cpp",
137        "tests/ByteBucketArray_test.cpp",
138        "tests/Config_test.cpp",
139        "tests/ConfigDescription_test.cpp",
140        "tests/ConfigLocale_test.cpp",
141        "tests/DynamicRefTable_test.cpp",
142        "tests/Idmap_test.cpp",
143        "tests/LoadedArsc_test.cpp",
144        "tests/Locale_test.cpp",
145        "tests/ResourceUtils_test.cpp",
146        "tests/ResTable_test.cpp",
147        "tests/Split_test.cpp",
148        "tests/StringPiece_test.cpp",
149        "tests/Theme_test.cpp",
150        "tests/TypeWrappers_test.cpp",
151        "tests/ZipUtils_test.cpp",
152    ],
153    static_libs: ["libgmock"],
154    target: {
155        android: {
156            srcs: [
157                "tests/BackupData_test.cpp",
158                "tests/ObbFile_test.cpp",
159                "tests/PosixUtils_test.cpp",
160            ],
161            shared_libs: common_test_libs + ["libui"],
162        },
163        host: {
164            static_libs: common_test_libs + ["liblog", "libz"],
165        },
166    },
167    data: [
168        "tests/data/**/*.apk",
169        "tests/data/**/*.arsc",
170        "tests/data/**/*.idmap",
171    ],
172    test_suites: ["device-tests"],
173}
174
175cc_benchmark {
176    name: "libandroidfw_benchmarks",
177    defaults: ["libandroidfw_defaults"],
178    srcs: [
179        // Helpers/infra for benchmarking.
180        "tests/BenchMain.cpp",
181        "tests/BenchmarkHelpers.cpp",
182        "tests/CommonHelpers.cpp",
183
184        // Actual benchmarks.
185        "tests/AssetManager2_bench.cpp",
186        "tests/AttributeResolution_bench.cpp",
187        "tests/SparseEntry_bench.cpp",
188        "tests/Theme_bench.cpp",
189    ],
190    shared_libs: common_test_libs,
191    data: ["tests/data/**/*.apk"],
192}
193