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 "DisplayEventDispatcher.cpp", 71 ], 72 shared_libs: [ 73 "libziparchive", 74 "libbase", 75 "libbinder", 76 "liblog", 77 "libcutils", 78 "libgui", 79 "libutils", 80 "libz", 81 ], 82 static: { 83 enabled: false, 84 }, 85 }, 86 host: { 87 shared: { 88 enabled: false, 89 }, 90 static_libs: [ 91 "libziparchive", 92 "libbase", 93 "liblog", 94 "libcutils", 95 "libutils", 96 ], 97 shared_libs: [ 98 "libz", 99 ], 100 }, 101 windows: { 102 enabled: true, 103 }, 104 }, 105 sanitize: { 106 blocklist: "libandroidfw_blocklist.txt", 107 }, 108} 109 110common_test_libs = [ 111 "libandroidfw", 112 "libbase", 113 "libcutils", 114 "libutils", 115 "libziparchive", 116] 117 118cc_test { 119 name: "libandroidfw_tests", 120 host_supported: true, 121 defaults: ["libandroidfw_defaults"], 122 cppflags: [ 123 // This is to suppress warnings/errors from gtest 124 "-Wno-unnamed-type-template-args", 125 ], 126 srcs: [ 127 // Helpers/infra for testing. 128 "tests/CommonHelpers.cpp", 129 "tests/TestHelpers.cpp", 130 "tests/TestMain.cpp", 131 132 // Actual tests. 133 "tests/ApkAssets_test.cpp", 134 "tests/AppAsLib_test.cpp", 135 "tests/Asset_test.cpp", 136 "tests/AssetManager2_test.cpp", 137 "tests/AttributeFinder_test.cpp", 138 "tests/AttributeResolution_test.cpp", 139 "tests/ByteBucketArray_test.cpp", 140 "tests/Config_test.cpp", 141 "tests/ConfigDescription_test.cpp", 142 "tests/ConfigLocale_test.cpp", 143 "tests/DynamicRefTable_test.cpp", 144 "tests/Idmap_test.cpp", 145 "tests/LoadedArsc_test.cpp", 146 "tests/Locale_test.cpp", 147 "tests/ResourceUtils_test.cpp", 148 "tests/ResTable_test.cpp", 149 "tests/Split_test.cpp", 150 "tests/StringPiece_test.cpp", 151 "tests/Theme_test.cpp", 152 "tests/TypeWrappers_test.cpp", 153 "tests/ZipUtils_test.cpp", 154 ], 155 static_libs: ["libgmock"], 156 target: { 157 android: { 158 srcs: [ 159 "tests/BackupData_test.cpp", 160 "tests/ObbFile_test.cpp", 161 "tests/PosixUtils_test.cpp", 162 ], 163 shared_libs: common_test_libs + ["libui"], 164 }, 165 host: { 166 static_libs: common_test_libs + ["liblog", "libz"], 167 }, 168 }, 169 data: ["tests/data/**/*.apk"], 170 test_suites: ["device-tests"], 171} 172 173cc_benchmark { 174 name: "libandroidfw_benchmarks", 175 defaults: ["libandroidfw_defaults"], 176 srcs: [ 177 // Helpers/infra for benchmarking. 178 "tests/BenchMain.cpp", 179 "tests/BenchmarkHelpers.cpp", 180 "tests/CommonHelpers.cpp", 181 182 // Actual benchmarks. 183 "tests/AssetManager2_bench.cpp", 184 "tests/AttributeResolution_bench.cpp", 185 "tests/SparseEntry_bench.cpp", 186 "tests/Theme_bench.cpp", 187 ], 188 shared_libs: common_test_libs, 189 data: ["tests/data/**/*.apk"], 190} 191 192