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