| // Copyright (C) 2010 The Android Open Source Project | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software | |
| // distributed under the License is distributed on an "AS IS" BASIS, | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| // See the License for the specific language governing permissions and | |
| // limitations under the License. | |
| // libandroidfw is partially built for the host (used by obbtool, aapt, and others) | |
| package { | |
| default_applicable_licenses: ["frameworks_base_libs_androidfw_license"], | |
| } | |
| // Added automatically by a large-scale-change | |
| // See: http://go/android-license-faq | |
| license { | |
| name: "frameworks_base_libs_androidfw_license", | |
| visibility: [":__subpackages__"], | |
| license_kinds: [ | |
| "SPDX-license-identifier-Apache-2.0", | |
| ], | |
| license_text: [ | |
| "NOTICE", | |
| ], | |
| } | |
| cc_aconfig_library { | |
| name: "backup_flags_cc_lib", | |
| host_supported: true, | |
| aconfig_declarations: "backup_flags", | |
| } | |
| cc_defaults { | |
| name: "libandroidfw_defaults", | |
| cpp_std: "gnu++2b", | |
| cflags: [ | |
| "-Werror", | |
| "-Wunreachable-code", | |
| ], | |
| target: { | |
| windows: { | |
| // The Windows compiler warns incorrectly for value initialization with {}. | |
| cppflags: ["-Wno-missing-field-initializers"], | |
| }, | |
| host: { | |
| cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"], | |
| }, | |
| }, | |
| } | |
| cc_library { | |
| name: "libandroidfw", | |
| defaults: ["libandroidfw_defaults"], | |
| host_supported: true, | |
| srcs: [ | |
| "ApkAssets.cpp", | |
| "ApkParsing.cpp", | |
| "Asset.cpp", | |
| "AssetDir.cpp", | |
| "AssetManager.cpp", | |
| "AssetManager2.cpp", | |
| "AssetsProvider.cpp", | |
| "AttributeResolution.cpp", | |
| "BigBuffer.cpp", | |
| "BigBufferStream.cpp", | |
| "ChunkIterator.cpp", | |
| "ConfigDescription.cpp", | |
| "FileStream.cpp", | |
| "Idmap.cpp", | |
| "LoadedArsc.cpp", | |
| "Locale.cpp", | |
| "LocaleData.cpp", | |
| "misc.cpp", | |
| "NinePatch.cpp", | |
| "ObbFile.cpp", | |
| "PosixUtils.cpp", | |
| "Png.cpp", | |
| "PngChunkFilter.cpp", | |
| "PngCrunch.cpp", | |
| "ResourceTimer.cpp", | |
| "ResourceTypes.cpp", | |
| "ResourceUtils.cpp", | |
| "StreamingZipInflater.cpp", | |
| "StringPool.cpp", | |
| "TypeWrappers.cpp", | |
| "Util.cpp", | |
| "ZipFileRO.cpp", | |
| "ZipUtils.cpp", | |
| ], | |
| export_include_dirs: ["include"], | |
| export_shared_lib_headers: ["libz"], | |
| static_libs: [ | |
| "libincfs-utils", | |
| "libpng", | |
| ], | |
| whole_static_libs: [ | |
| "libandroidfw_pathutils", | |
| "libincfs-utils", | |
| ], | |
| export_static_lib_headers: ["libincfs-utils"], | |
| target: { | |
| android: { | |
| srcs: [ | |
| "BackupData.cpp", | |
| "BackupHelpers.cpp", | |
| "CursorWindow.cpp", | |
| ], | |
| shared_libs: [ | |
| "libbase", | |
| "libbinder", | |
| "liblog", | |
| "libcutils", | |
| "libincfs", | |
| "libutils", | |
| "libz", | |
| ], | |
| static_libs: [ | |
| "libziparchive_for_incfs", | |
| "backup_flags_cc_lib", | |
| ], | |
| static: { | |
| enabled: false, | |
| }, | |
| }, | |
| host: { | |
| shared: { | |
| enabled: false, | |
| }, | |
| static_libs: [ | |
| "libbase", | |
| "libcutils", | |
| "liblog", | |
| "libutils", | |
| "libziparchive", | |
| ], | |
| shared_libs: [ | |
| "libz", | |
| ], | |
| }, | |
| host_linux: { | |
| srcs: [ | |
| "CursorWindow.cpp", | |
| ], | |
| }, | |
| windows: { | |
| enabled: true, | |
| }, | |
| }, | |
| sanitize: { | |
| blocklist: "libandroidfw_blocklist.txt", | |
| }, | |
| } | |
| cc_library_static { | |
| name: "libandroidfw_pathutils", | |
| defaults: ["libandroidfw_defaults"], | |
| host_supported: true, | |
| export_include_dirs: ["include_pathutils"], | |
| srcs: [ | |
| "PathUtils.cpp", | |
| ], | |
| shared_libs: [ | |
| "libutils", | |
| ], | |
| target: { | |
| windows: { | |
| enabled: true, | |
| }, | |
| }, | |
| visibility: [ | |
| ":__subpackages__", | |
| "//frameworks/base/tools/aapt", | |
| ], | |
| } | |
| common_test_libs = [ | |
| "libandroidfw", | |
| "libbase", | |
| "libcutils", | |
| "libutils", | |
| "libziparchive", | |
| ] | |
| cc_test { | |
| name: "libandroidfw_tests", | |
| host_supported: true, | |
| defaults: ["libandroidfw_defaults"], | |
| cppflags: [ | |
| // This is to suppress warnings/errors from gtest | |
| "-Wno-unnamed-type-template-args", | |
| ], | |
| srcs: [ | |
| // Helpers/infra for testing. | |
| "tests/CommonHelpers.cpp", | |
| "tests/TestHelpers.cpp", | |
| "tests/TestMain.cpp", | |
| // Actual tests. | |
| "tests/ApkAssets_test.cpp", | |
| "tests/ApkParsing_test.cpp", | |
| "tests/AppAsLib_test.cpp", | |
| "tests/Asset_test.cpp", | |
| "tests/AssetManager2_test.cpp", | |
| "tests/AttributeFinder_test.cpp", | |
| "tests/AttributeResolution_test.cpp", | |
| "tests/BigBuffer_test.cpp", | |
| "tests/ByteBucketArray_test.cpp", | |
| "tests/Config_test.cpp", | |
| "tests/ConfigDescription_test.cpp", | |
| "tests/ConfigLocale_test.cpp", | |
| "tests/DynamicRefTable_test.cpp", | |
| "tests/FileStream_test.cpp", | |
| "tests/Idmap_test.cpp", | |
| "tests/LoadedArsc_test.cpp", | |
| "tests/Locale_test.cpp", | |
| "tests/NinePatch_test.cpp", | |
| "tests/ResourceTimer_test.cpp", | |
| "tests/ResourceTypes_test.cpp", | |
| "tests/ResourceUtils_test.cpp", | |
| "tests/ResTable_test.cpp", | |
| "tests/Split_test.cpp", | |
| "tests/StringPiece_test.cpp", | |
| "tests/StringPool_test.cpp", | |
| "tests/Theme_test.cpp", | |
| "tests/TypeWrappers_test.cpp", | |
| "tests/ZipUtils_test.cpp", | |
| ], | |
| static_libs: ["libgmock"], | |
| target: { | |
| android: { | |
| srcs: [ | |
| "tests/BackupData_test.cpp", | |
| "tests/BackupHelpers_test.cpp", | |
| "tests/CursorWindow_test.cpp", | |
| "tests/ObbFile_test.cpp", | |
| "tests/PosixUtils_test.cpp", | |
| ], | |
| shared_libs: common_test_libs + [ | |
| "libbinder", | |
| "liblog", | |
| "libui", | |
| ], | |
| }, | |
| host: { | |
| static_libs: common_test_libs + [ | |
| "liblog", | |
| "libz", | |
| ], | |
| }, | |
| }, | |
| data: [ | |
| "tests/data/**/*.apk", | |
| "tests/data/**/*.arsc", | |
| "tests/data/**/*.idmap", | |
| ":FrameworkResourcesSparseTestApp", | |
| ":FrameworkResourcesNotSparseTestApp", | |
| ], | |
| test_suites: ["device-tests"], | |
| } | |
| cc_benchmark { | |
| name: "libandroidfw_benchmarks", | |
| defaults: ["libandroidfw_defaults"], | |
| srcs: [ | |
| // Helpers/infra for benchmarking. | |
| "tests/BenchMain.cpp", | |
| "tests/BenchmarkHelpers.cpp", | |
| "tests/CommonHelpers.cpp", | |
| // Actual benchmarks. | |
| "tests/AssetManager2_bench.cpp", | |
| "tests/AttributeResolution_bench.cpp", | |
| "tests/CursorWindow_bench.cpp", | |
| "tests/Generic_bench.cpp", | |
| "tests/SparseEntry_bench.cpp", | |
| "tests/Theme_bench.cpp", | |
| ], | |
| shared_libs: common_test_libs, | |
| data: ["tests/data/**/*.apk"], | |
| } | |
| cc_library { | |
| name: "libandroidfw_fuzzer_lib", | |
| defaults: ["libandroidfw_defaults"], | |
| host_supported: true, | |
| srcs: [ | |
| "CursorWindow.cpp", | |
| ], | |
| export_include_dirs: ["include"], | |
| target: { | |
| android: { | |
| shared_libs: common_test_libs + [ | |
| "libbinder", | |
| "liblog", | |
| ], | |
| }, | |
| host: { | |
| static_libs: common_test_libs + [ | |
| "libbinder", | |
| "liblog", | |
| ], | |
| }, | |
| darwin: { | |
| // libbinder is not supported on mac | |
| enabled: false, | |
| }, | |
| }, | |
| } |