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