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