Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 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 | |
Bob Badour | 8a6a2bc | 2021-02-12 17:07:05 -0800 | [diff] [blame] | 17 | package { |
| 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 |
| 23 | license { |
| 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 | |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 34 | cc_defaults { |
| 35 | name: "libandroidfw_defaults", |
Yurii Zubrytskyi | ba6f8a3 | 2022-02-16 17:00:42 -0800 | [diff] [blame] | 36 | cpp_std: "gnu++2b", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 37 | cflags: [ |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 38 | "-Werror", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 39 | "-Wunreachable-code", |
| 40 | ], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 41 | target: { |
| 42 | windows: { |
| 43 | // The Windows compiler warns incorrectly for value initialization with {}. |
| 44 | cppflags: ["-Wno-missing-field-initializers"], |
| 45 | }, |
| 46 | host: { |
| 47 | cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"], |
| 48 | }, |
| 49 | }, |
| 50 | } |
| 51 | |
| 52 | cc_library { |
| 53 | name: "libandroidfw", |
| 54 | defaults: ["libandroidfw_defaults"], |
| 55 | host_supported: true, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 56 | srcs: [ |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 57 | "ApkAssets.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 58 | "Asset.cpp", |
| 59 | "AssetDir.cpp", |
| 60 | "AssetManager.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 61 | "AssetManager2.cpp", |
Ryan Mitchell | 1a48fa6 | 2021-01-10 08:36:36 -0800 | [diff] [blame] | 62 | "AssetsProvider.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 63 | "AttributeResolution.cpp", |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 64 | "BigBuffer.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 65 | "ChunkIterator.cpp", |
Mårten Kongstad | 24c9aa6 | 2018-06-20 08:46:41 +0200 | [diff] [blame] | 66 | "ConfigDescription.cpp", |
Adam Lesinski | 970bd8d | 2017-09-25 13:21:55 -0700 | [diff] [blame] | 67 | "Idmap.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 68 | "LoadedArsc.cpp", |
Mårten Kongstad | 24c9aa6 | 2018-06-20 08:46:41 +0200 | [diff] [blame] | 69 | "Locale.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 70 | "LocaleData.cpp", |
| 71 | "misc.cpp", |
| 72 | "ObbFile.cpp", |
Mårten Kongstad | 2503a49 | 2018-09-27 13:32:30 +0200 | [diff] [blame] | 73 | "PosixUtils.cpp", |
Lee Shombert | 3e4d9f2 | 2022-09-18 18:02:31 -0700 | [diff] [blame] | 74 | "ResourceTimer.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 75 | "ResourceTypes.cpp", |
Adam Lesinski | 929d651 | 2017-01-16 19:11:19 -0800 | [diff] [blame] | 76 | "ResourceUtils.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 77 | "StreamingZipInflater.cpp", |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 78 | "StringPool.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 79 | "TypeWrappers.cpp", |
Adam Lesinski | da431a2 | 2016-12-29 16:08:16 -0500 | [diff] [blame] | 80 | "Util.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 81 | "ZipFileRO.cpp", |
| 82 | "ZipUtils.cpp", |
| 83 | ], |
| 84 | export_include_dirs: ["include"], |
Dan Willemsen | 4888b1f | 2018-05-09 20:30:33 -0700 | [diff] [blame] | 85 | export_shared_lib_headers: ["libz"], |
Ryan Mitchell | db21f09a | 2020-11-16 23:08:18 +0000 | [diff] [blame] | 86 | static_libs: ["libincfs-utils"], |
| 87 | whole_static_libs: ["libincfs-utils"], |
| 88 | export_static_lib_headers: ["libincfs-utils"], |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 89 | target: { |
| 90 | android: { |
| 91 | srcs: [ |
| 92 | "BackupData.cpp", |
| 93 | "BackupHelpers.cpp", |
| 94 | "CursorWindow.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 95 | ], |
| 96 | shared_libs: [ |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 97 | "libbase", |
| 98 | "libbinder", |
| 99 | "liblog", |
| 100 | "libcutils", |
Ryan Mitchell | db21f09a | 2020-11-16 23:08:18 +0000 | [diff] [blame] | 101 | "libincfs", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 102 | "libutils", |
| 103 | "libz", |
| 104 | ], |
Yurii Zubrytskyi | 80d0f4c | 2021-02-26 03:53:04 -0500 | [diff] [blame] | 105 | static_libs: ["libziparchive_for_incfs"], |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 106 | static: { |
| 107 | enabled: false, |
| 108 | }, |
| 109 | }, |
| 110 | host: { |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 111 | shared: { |
| 112 | enabled: false, |
| 113 | }, |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 114 | static_libs: [ |
Ryan Mitchell | 55ef616 | 2020-11-13 23:55:20 +0000 | [diff] [blame] | 115 | "libbase", |
Ryan Mitchell | 55ef616 | 2020-11-13 23:55:20 +0000 | [diff] [blame] | 116 | "libcutils", |
Ryan Mitchell | db21f09a | 2020-11-16 23:08:18 +0000 | [diff] [blame] | 117 | "liblog", |
Ryan Mitchell | 55ef616 | 2020-11-13 23:55:20 +0000 | [diff] [blame] | 118 | "libutils", |
Ryan Mitchell | db21f09a | 2020-11-16 23:08:18 +0000 | [diff] [blame] | 119 | "libziparchive", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 120 | ], |
| 121 | shared_libs: [ |
Dan Willemsen | a2902e3 | 2017-09-27 16:20:31 -0700 | [diff] [blame] | 122 | "libz", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 123 | ], |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 124 | }, |
Colin Cross | e8f6f0b | 2022-03-08 18:17:43 -0800 | [diff] [blame] | 125 | host_linux: { |
Jerome Gaillard | 1044702 | 2020-11-02 16:16:17 +0000 | [diff] [blame] | 126 | srcs: [ |
| 127 | "CursorWindow.cpp", |
| 128 | ], |
| 129 | }, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 130 | windows: { |
| 131 | enabled: true, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 132 | }, |
| 133 | }, |
Ivan Lozano | 0282874 | 2017-11-07 13:26:27 -0800 | [diff] [blame] | 134 | sanitize: { |
Pirama Arumuga Nainar | 88db303 | 2020-07-28 14:38:20 -0700 | [diff] [blame] | 135 | blocklist: "libandroidfw_blocklist.txt", |
Ivan Lozano | 0282874 | 2017-11-07 13:26:27 -0800 | [diff] [blame] | 136 | }, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 137 | } |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 138 | |
| 139 | common_test_libs = [ |
| 140 | "libandroidfw", |
| 141 | "libbase", |
| 142 | "libcutils", |
| 143 | "libutils", |
| 144 | "libziparchive", |
| 145 | ] |
| 146 | |
| 147 | cc_test { |
| 148 | name: "libandroidfw_tests", |
| 149 | host_supported: true, |
| 150 | defaults: ["libandroidfw_defaults"], |
| 151 | cppflags: [ |
| 152 | // This is to suppress warnings/errors from gtest |
| 153 | "-Wno-unnamed-type-template-args", |
| 154 | ], |
| 155 | srcs: [ |
| 156 | // Helpers/infra for testing. |
| 157 | "tests/CommonHelpers.cpp", |
| 158 | "tests/TestHelpers.cpp", |
| 159 | "tests/TestMain.cpp", |
| 160 | |
| 161 | // Actual tests. |
| 162 | "tests/ApkAssets_test.cpp", |
| 163 | "tests/AppAsLib_test.cpp", |
| 164 | "tests/Asset_test.cpp", |
| 165 | "tests/AssetManager2_test.cpp", |
| 166 | "tests/AttributeFinder_test.cpp", |
| 167 | "tests/AttributeResolution_test.cpp", |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 168 | "tests/BigBuffer_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 169 | "tests/ByteBucketArray_test.cpp", |
| 170 | "tests/Config_test.cpp", |
Mårten Kongstad | 24c9aa6 | 2018-06-20 08:46:41 +0200 | [diff] [blame] | 171 | "tests/ConfigDescription_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 172 | "tests/ConfigLocale_test.cpp", |
Ryan Mitchell | b9b540b | 2018-08-22 11:22:54 -0700 | [diff] [blame] | 173 | "tests/DynamicRefTable_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 174 | "tests/Idmap_test.cpp", |
| 175 | "tests/LoadedArsc_test.cpp", |
Mårten Kongstad | 24c9aa6 | 2018-06-20 08:46:41 +0200 | [diff] [blame] | 176 | "tests/Locale_test.cpp", |
Lee Shombert | 3e4d9f2 | 2022-09-18 18:02:31 -0700 | [diff] [blame] | 177 | "tests/ResourceTimer_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 178 | "tests/ResourceUtils_test.cpp", |
| 179 | "tests/ResTable_test.cpp", |
| 180 | "tests/Split_test.cpp", |
| 181 | "tests/StringPiece_test.cpp", |
Jeremy Meyer | 56f36e8 | 2022-05-20 20:35:42 +0000 | [diff] [blame] | 182 | "tests/StringPool_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 183 | "tests/Theme_test.cpp", |
| 184 | "tests/TypeWrappers_test.cpp", |
| 185 | "tests/ZipUtils_test.cpp", |
| 186 | ], |
Adam Lesinski | bebfcc4 | 2018-02-12 14:27:46 -0800 | [diff] [blame] | 187 | static_libs: ["libgmock"], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 188 | target: { |
| 189 | android: { |
| 190 | srcs: [ |
| 191 | "tests/BackupData_test.cpp", |
Jeff Sharkey | ae2d88a | 2020-09-26 18:57:32 -0600 | [diff] [blame] | 192 | "tests/BackupHelpers_test.cpp", |
| 193 | "tests/CursorWindow_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 194 | "tests/ObbFile_test.cpp", |
Mårten Kongstad | 2503a49 | 2018-09-27 13:32:30 +0200 | [diff] [blame] | 195 | "tests/PosixUtils_test.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 196 | ], |
Brett Chabot | de3a2bc | 2020-11-04 08:59:06 -0800 | [diff] [blame] | 197 | shared_libs: common_test_libs + [ |
| 198 | "libbinder", |
| 199 | "liblog", |
| 200 | "libui", |
| 201 | ], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 202 | }, |
| 203 | host: { |
Brett Chabot | de3a2bc | 2020-11-04 08:59:06 -0800 | [diff] [blame] | 204 | static_libs: common_test_libs + [ |
| 205 | "liblog", |
| 206 | "libz", |
| 207 | ], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 208 | }, |
| 209 | }, |
Winson | 9947f1e | 2019-08-16 10:20:39 -0700 | [diff] [blame] | 210 | data: [ |
Ryan Mitchell | 8a891d8 | 2019-07-01 09:48:23 -0700 | [diff] [blame] | 211 | "tests/data/**/*.apk", |
| 212 | "tests/data/**/*.arsc", |
| 213 | "tests/data/**/*.idmap", |
Brandon Liu | 742b11e | 2022-11-03 23:23:28 +0000 | [diff] [blame] | 214 | ":FrameworkResourcesSparseTestApp", |
| 215 | ":FrameworkResourcesNotSparseTestApp", |
Winson | 9947f1e | 2019-08-16 10:20:39 -0700 | [diff] [blame] | 216 | ], |
Dan Shi | 8d7267e | 2018-12-18 16:06:40 -0800 | [diff] [blame] | 217 | test_suites: ["device-tests"], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | cc_benchmark { |
| 221 | name: "libandroidfw_benchmarks", |
| 222 | defaults: ["libandroidfw_defaults"], |
| 223 | srcs: [ |
| 224 | // Helpers/infra for benchmarking. |
| 225 | "tests/BenchMain.cpp", |
| 226 | "tests/BenchmarkHelpers.cpp", |
| 227 | "tests/CommonHelpers.cpp", |
| 228 | |
| 229 | // Actual benchmarks. |
| 230 | "tests/AssetManager2_bench.cpp", |
Adam Lesinski | bebfcc4 | 2018-02-12 14:27:46 -0800 | [diff] [blame] | 231 | "tests/AttributeResolution_bench.cpp", |
Jeff Sharkey | ae2d88a | 2020-09-26 18:57:32 -0600 | [diff] [blame] | 232 | "tests/CursorWindow_bench.cpp", |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 233 | "tests/SparseEntry_bench.cpp", |
| 234 | "tests/Theme_bench.cpp", |
| 235 | ], |
| 236 | shared_libs: common_test_libs, |
| 237 | data: ["tests/data/**/*.apk"], |
| 238 | } |
Jeff Sharkey | 256da5a | 2020-10-13 09:40:52 -0600 | [diff] [blame] | 239 | |
| 240 | cc_library { |
| 241 | name: "libandroidfw_fuzzer_lib", |
| 242 | defaults: ["libandroidfw_defaults"], |
| 243 | host_supported: true, |
| 244 | srcs: [ |
| 245 | "CursorWindow.cpp", |
| 246 | ], |
| 247 | export_include_dirs: ["include"], |
| 248 | target: { |
| 249 | android: { |
Brett Chabot | de3a2bc | 2020-11-04 08:59:06 -0800 | [diff] [blame] | 250 | shared_libs: common_test_libs + [ |
| 251 | "libbinder", |
| 252 | "liblog", |
| 253 | ], |
Jeff Sharkey | 256da5a | 2020-10-13 09:40:52 -0600 | [diff] [blame] | 254 | }, |
| 255 | host: { |
Brett Chabot | de3a2bc | 2020-11-04 08:59:06 -0800 | [diff] [blame] | 256 | static_libs: common_test_libs + [ |
| 257 | "libbinder", |
| 258 | "liblog", |
| 259 | ], |
| 260 | }, |
| 261 | darwin: { |
| 262 | // libbinder is not supported on mac |
| 263 | enabled: false, |
Jeff Sharkey | 256da5a | 2020-10-13 09:40:52 -0600 | [diff] [blame] | 264 | }, |
| 265 | }, |
| 266 | } |