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