Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 1 | // Copyright (C) 2019 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 | package cc |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
Colin Cross | e9fe294 | 2020-11-10 18:12:15 -0800 | [diff] [blame] | 19 | "android/soong/genrule" |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 20 | ) |
| 21 | |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 22 | func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 23 | RegisterPrebuiltBuildComponents(ctx) |
Paul Duffin | 036e700 | 2019-12-19 19:16:28 +0000 | [diff] [blame] | 24 | RegisterCCBuildComponents(ctx) |
Paul Duffin | 2ee6979 | 2020-01-16 12:14:42 +0000 | [diff] [blame] | 25 | RegisterBinaryBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 26 | RegisterLibraryBuildComponents(ctx) |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 27 | RegisterLibraryHeadersBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 28 | |
| 29 | ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) |
| 30 | ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) |
Jiyong Park | 46a512f | 2020-12-04 18:02:13 +0900 | [diff] [blame] | 31 | ctx.RegisterModuleType("cc_benchmark", BenchmarkFactory) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 32 | ctx.RegisterModuleType("cc_object", ObjectFactory) |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 33 | ctx.RegisterModuleType("cc_genrule", genRuleFactory) |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 34 | ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory) |
| 35 | ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory) |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 36 | ctx.RegisterModuleType("ndk_library", NdkLibraryFactory) |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 37 | } |
| 38 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 39 | func GatherRequiredDepsForTest(oses ...android.OsType) string { |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 40 | ret := commonDefaultModules() |
| 41 | |
| 42 | supportLinuxBionic := false |
| 43 | for _, os := range oses { |
| 44 | if os == android.Fuchsia { |
| 45 | ret += withFuchsiaModules() |
| 46 | } |
| 47 | if os == android.Windows { |
| 48 | ret += withWindowsModules() |
| 49 | } |
| 50 | if os == android.LinuxBionic { |
| 51 | supportLinuxBionic = true |
| 52 | ret += withLinuxBionic() |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | if !supportLinuxBionic { |
| 57 | ret += withoutLinuxBionic() |
| 58 | } |
| 59 | |
| 60 | return ret |
| 61 | } |
| 62 | |
| 63 | func commonDefaultModules() string { |
| 64 | return ` |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 65 | toolchain_library { |
| 66 | name: "libatomic", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 67 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 68 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 69 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 70 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 71 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 72 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 73 | src: "", |
| 74 | } |
| 75 | |
| 76 | toolchain_library { |
| 77 | name: "libcompiler_rt-extras", |
| 78 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 79 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 80 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 81 | recovery_available: true, |
| 82 | src: "", |
| 83 | } |
| 84 | |
| 85 | toolchain_library { |
| 86 | name: "libclang_rt.builtins-arm-android", |
| 87 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 88 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 89 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 90 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 91 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 92 | src: "", |
| 93 | } |
| 94 | |
| 95 | toolchain_library { |
| 96 | name: "libclang_rt.builtins-aarch64-android", |
| 97 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 98 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 99 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 100 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 101 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 102 | src: "", |
| 103 | } |
| 104 | |
Jooyung Han | 7556839 | 2020-03-20 04:29:24 +0900 | [diff] [blame] | 105 | cc_prebuilt_library_shared { |
| 106 | name: "libclang_rt.hwasan-aarch64-android", |
| 107 | nocrt: true, |
| 108 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 109 | product_available: true, |
Jooyung Han | 7556839 | 2020-03-20 04:29:24 +0900 | [diff] [blame] | 110 | recovery_available: true, |
| 111 | system_shared_libs: [], |
| 112 | stl: "none", |
| 113 | srcs: [""], |
| 114 | check_elf_files: false, |
| 115 | sanitize: { |
| 116 | never: true, |
| 117 | }, |
| 118 | } |
| 119 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 120 | toolchain_library { |
| 121 | name: "libclang_rt.builtins-i686-android", |
| 122 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 123 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 124 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 125 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 126 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 127 | src: "", |
| 128 | } |
| 129 | |
| 130 | toolchain_library { |
| 131 | name: "libclang_rt.builtins-x86_64-android", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 132 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 133 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 134 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 135 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 136 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 137 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 138 | src: "", |
| 139 | } |
| 140 | |
| 141 | toolchain_library { |
Ryan Prichard | b35a85e | 2021-01-13 19:18:53 -0800 | [diff] [blame] | 142 | name: "libunwind", |
| 143 | defaults: ["linux_bionic_supported"], |
| 144 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 145 | vendor_ramdisk_available: true, |
Ryan Prichard | b35a85e | 2021-01-13 19:18:53 -0800 | [diff] [blame] | 146 | product_available: true, |
| 147 | recovery_available: true, |
| 148 | native_bridge_supported: true, |
| 149 | src: "", |
| 150 | } |
| 151 | |
| 152 | toolchain_library { |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 153 | name: "libclang_rt.fuzzer-arm-android", |
| 154 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 155 | product_available: true, |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 156 | recovery_available: true, |
| 157 | src: "", |
| 158 | } |
| 159 | |
| 160 | toolchain_library { |
| 161 | name: "libclang_rt.fuzzer-aarch64-android", |
| 162 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 163 | product_available: true, |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 164 | recovery_available: true, |
| 165 | src: "", |
| 166 | } |
| 167 | |
| 168 | toolchain_library { |
| 169 | name: "libclang_rt.fuzzer-i686-android", |
| 170 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 171 | product_available: true, |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 172 | recovery_available: true, |
| 173 | src: "", |
| 174 | } |
| 175 | |
| 176 | toolchain_library { |
| 177 | name: "libclang_rt.fuzzer-x86_64-android", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 178 | defaults: ["linux_bionic_supported"], |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 179 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 180 | product_available: true, |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 181 | recovery_available: true, |
| 182 | src: "", |
| 183 | } |
| 184 | |
| 185 | toolchain_library { |
| 186 | name: "libclang_rt.fuzzer-x86_64", |
| 187 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 188 | product_available: true, |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 189 | recovery_available: true, |
| 190 | src: "", |
| 191 | } |
| 192 | |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 193 | // Needed for sanitizer |
| 194 | cc_prebuilt_library_shared { |
| 195 | name: "libclang_rt.ubsan_standalone-aarch64-android", |
| 196 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 197 | product_available: true, |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 198 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 199 | system_shared_libs: [], |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 200 | srcs: [""], |
| 201 | } |
| 202 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 203 | toolchain_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 204 | name: "libgcc", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 205 | defaults: ["linux_bionic_supported"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 206 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 207 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 208 | recovery_available: true, |
| 209 | src: "", |
Jiyong Park | 99644e9 | 2020-11-17 22:21:02 +0900 | [diff] [blame] | 210 | apex_available: [ |
| 211 | "//apex_available:platform", |
| 212 | "//apex_available:anyapex", |
| 213 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 214 | } |
| 215 | |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 216 | toolchain_library { |
| 217 | name: "libgcc_stripped", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 218 | defaults: ["linux_bionic_supported"], |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 219 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 220 | product_available: true, |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 221 | recovery_available: true, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 222 | sdk_version: "current", |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 223 | src: "", |
| 224 | } |
| 225 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 226 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 227 | name: "libc", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 228 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 229 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 230 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 231 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 232 | system_shared_libs: [], |
| 233 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 234 | stubs: { |
| 235 | versions: ["27", "28", "29"], |
| 236 | }, |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 237 | llndk_stubs: "libc.llndk", |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 238 | } |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 239 | llndk_library { |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 240 | name: "libc.llndk", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 241 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 242 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 243 | } |
| 244 | cc_library { |
| 245 | name: "libm", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 246 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 247 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 248 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 249 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 250 | system_shared_libs: [], |
| 251 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 252 | stubs: { |
| 253 | versions: ["27", "28", "29"], |
| 254 | }, |
| 255 | apex_available: [ |
| 256 | "//apex_available:platform", |
| 257 | "myapex" |
| 258 | ], |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 259 | llndk_stubs: "libm.llndk", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 260 | } |
| 261 | llndk_library { |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 262 | name: "libm.llndk", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 263 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 264 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 265 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 266 | |
| 267 | // Coverage libraries |
| 268 | cc_library { |
| 269 | name: "libprofile-extras", |
| 270 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 271 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 272 | product_available: true, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 273 | recovery_available: true, |
| 274 | native_coverage: false, |
| 275 | system_shared_libs: [], |
| 276 | stl: "none", |
| 277 | notice: "custom_notice", |
| 278 | } |
| 279 | cc_library { |
| 280 | name: "libprofile-clang-extras", |
| 281 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 282 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 283 | product_available: true, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 284 | recovery_available: true, |
| 285 | native_coverage: false, |
| 286 | system_shared_libs: [], |
| 287 | stl: "none", |
| 288 | notice: "custom_notice", |
| 289 | } |
| 290 | cc_library { |
| 291 | name: "libprofile-extras_ndk", |
| 292 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 293 | product_available: true, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 294 | native_coverage: false, |
| 295 | system_shared_libs: [], |
| 296 | stl: "none", |
| 297 | notice: "custom_notice", |
| 298 | sdk_version: "current", |
| 299 | } |
| 300 | cc_library { |
| 301 | name: "libprofile-clang-extras_ndk", |
| 302 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 303 | product_available: true, |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame] | 304 | native_coverage: false, |
| 305 | system_shared_libs: [], |
| 306 | stl: "none", |
| 307 | notice: "custom_notice", |
| 308 | sdk_version: "current", |
| 309 | } |
| 310 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 311 | cc_library { |
| 312 | name: "libdl", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 313 | defaults: ["linux_bionic_supported"], |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 314 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 315 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 316 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 317 | system_shared_libs: [], |
| 318 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 319 | stubs: { |
| 320 | versions: ["27", "28", "29"], |
| 321 | }, |
| 322 | apex_available: [ |
| 323 | "//apex_available:platform", |
| 324 | "myapex" |
| 325 | ], |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 326 | llndk_stubs: "libdl.llndk", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 327 | } |
| 328 | llndk_library { |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 329 | name: "libdl.llndk", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 330 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 331 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 332 | } |
| 333 | cc_library { |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 334 | name: "libft2", |
| 335 | no_libcrt: true, |
| 336 | nocrt: true, |
| 337 | system_shared_libs: [], |
| 338 | recovery_available: true, |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 339 | llndk_stubs: "libft2.llndk", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 340 | } |
| 341 | llndk_library { |
Colin Cross | 0477b42 | 2020-10-13 18:43:54 -0700 | [diff] [blame] | 342 | name: "libft2.llndk", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 343 | symbol_file: "", |
Justin Yun | c0d8c49 | 2021-01-07 17:45:31 +0900 | [diff] [blame] | 344 | private: true, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 345 | sdk_version: "current", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 346 | } |
| 347 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 348 | name: "libc++_static", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 349 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 350 | nocrt: true, |
| 351 | system_shared_libs: [], |
| 352 | stl: "none", |
| 353 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 354 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 355 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 356 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 357 | host_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 358 | min_sdk_version: "29", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 359 | apex_available: [ |
| 360 | "//apex_available:platform", |
| 361 | "//apex_available:anyapex", |
| 362 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 363 | } |
| 364 | cc_library { |
| 365 | name: "libc++", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 366 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 367 | nocrt: true, |
| 368 | system_shared_libs: [], |
| 369 | stl: "none", |
| 370 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 371 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 372 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 373 | host_supported: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 374 | min_sdk_version: "29", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 375 | vndk: { |
| 376 | enabled: true, |
| 377 | support_system_process: true, |
| 378 | }, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 379 | apex_available: [ |
| 380 | "//apex_available:platform", |
Ivan Lozano | 3e9f9e4 | 2020-12-04 15:05:43 -0500 | [diff] [blame] | 381 | "//apex_available:anyapex", |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 382 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 383 | } |
| 384 | cc_library { |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 385 | name: "libc++demangle", |
| 386 | no_libcrt: true, |
| 387 | nocrt: true, |
| 388 | system_shared_libs: [], |
| 389 | stl: "none", |
| 390 | host_supported: false, |
| 391 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 392 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 393 | product_available: true, |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 394 | recovery_available: true, |
Jooyung Han | 749dc69 | 2020-04-15 11:03:39 +0900 | [diff] [blame] | 395 | min_sdk_version: "29", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 396 | apex_available: [ |
| 397 | "//apex_available:platform", |
| 398 | "//apex_available:anyapex", |
| 399 | ], |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 400 | } |
| 401 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 402 | name: "libunwind_llvm", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 403 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 404 | nocrt: true, |
| 405 | system_shared_libs: [], |
| 406 | stl: "none", |
| 407 | vendor_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 408 | product_available: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 409 | recovery_available: true, |
| 410 | } |
| 411 | |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 412 | cc_defaults { |
| 413 | name: "crt_defaults", |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 414 | defaults: ["linux_bionic_supported"], |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 415 | recovery_available: true, |
| 416 | vendor_available: true, |
Ivan Lozano | e6d3098 | 2021-02-05 10:57:43 -0500 | [diff] [blame] | 417 | vendor_ramdisk_available: true, |
Justin Yun | 63e9ec7 | 2020-10-29 16:49:43 +0900 | [diff] [blame] | 418 | product_available: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 419 | native_bridge_supported: true, |
| 420 | stl: "none", |
Dan Albert | 92fe740 | 2020-07-15 13:33:30 -0700 | [diff] [blame] | 421 | min_sdk_version: "16", |
| 422 | crt: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 423 | apex_available: [ |
| 424 | "//apex_available:platform", |
| 425 | "//apex_available:anyapex", |
| 426 | ], |
| 427 | } |
| 428 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 429 | cc_object { |
| 430 | name: "crtbegin_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 431 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 432 | } |
| 433 | |
| 434 | cc_object { |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 435 | name: "crtbegin_dynamic", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 436 | defaults: ["crt_defaults"], |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 437 | } |
| 438 | |
| 439 | cc_object { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 440 | name: "crtbegin_static", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 441 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | cc_object { |
| 445 | name: "crtend_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 446 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | cc_object { |
| 450 | name: "crtend_android", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 451 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 452 | } |
| 453 | |
| 454 | cc_library { |
| 455 | name: "libprotobuf-cpp-lite", |
| 456 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 457 | |
| 458 | cc_library { |
| 459 | name: "ndk_libunwind", |
| 460 | sdk_version: "current", |
| 461 | stl: "none", |
| 462 | system_shared_libs: [], |
| 463 | } |
| 464 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 465 | ndk_library { |
| 466 | name: "libc", |
| 467 | first_version: "minimum", |
| 468 | symbol_file: "libc.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 469 | } |
| 470 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 471 | ndk_library { |
| 472 | name: "libm", |
| 473 | first_version: "minimum", |
| 474 | symbol_file: "libm.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 475 | } |
| 476 | |
Dan Albert | de5aade | 2020-06-30 12:32:51 -0700 | [diff] [blame] | 477 | ndk_library { |
| 478 | name: "libdl", |
| 479 | first_version: "minimum", |
| 480 | symbol_file: "libdl.map.txt", |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 481 | } |
| 482 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 483 | ndk_prebuilt_shared_stl { |
| 484 | name: "ndk_libc++_shared", |
| 485 | } |
Jiyong Park | 46a512f | 2020-12-04 18:02:13 +0900 | [diff] [blame] | 486 | |
| 487 | cc_library_static { |
| 488 | name: "libgoogle-benchmark", |
| 489 | sdk_version: "current", |
| 490 | stl: "none", |
| 491 | system_shared_libs: [], |
| 492 | } |
Evgenii Stepanov | 193ac2e | 2020-04-28 15:09:12 -0700 | [diff] [blame] | 493 | |
| 494 | cc_library_static { |
| 495 | name: "note_memtag_heap_async", |
| 496 | } |
| 497 | |
| 498 | cc_library_static { |
| 499 | name: "note_memtag_heap_sync", |
| 500 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 501 | ` |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 502 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 503 | |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 504 | func withWindowsModules() string { |
| 505 | return ` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 506 | toolchain_library { |
| 507 | name: "libwinpthread", |
| 508 | host_supported: true, |
| 509 | enabled: false, |
| 510 | target: { |
| 511 | windows: { |
| 512 | enabled: true, |
| 513 | }, |
| 514 | }, |
| 515 | src: "", |
| 516 | } |
| 517 | ` |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 518 | } |
| 519 | |
| 520 | func withFuchsiaModules() string { |
| 521 | return ` |
| 522 | cc_library { |
| 523 | name: "libbioniccompat", |
| 524 | stl: "none", |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 525 | } |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 526 | cc_library { |
| 527 | name: "libcompiler_rt", |
| 528 | stl: "none", |
| 529 | } |
| 530 | ` |
| 531 | } |
| 532 | |
| 533 | func withLinuxBionic() string { |
| 534 | return ` |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 535 | cc_binary { |
| 536 | name: "linker", |
| 537 | defaults: ["linux_bionic_supported"], |
| 538 | recovery_available: true, |
| 539 | stl: "none", |
| 540 | nocrt: true, |
| 541 | static_executable: true, |
| 542 | native_coverage: false, |
| 543 | system_shared_libs: [], |
| 544 | } |
| 545 | |
| 546 | cc_genrule { |
| 547 | name: "host_bionic_linker_flags", |
| 548 | host_supported: true, |
| 549 | device_supported: false, |
| 550 | target: { |
| 551 | host: { |
| 552 | enabled: false, |
| 553 | }, |
| 554 | linux_bionic: { |
| 555 | enabled: true, |
| 556 | }, |
| 557 | }, |
| 558 | out: ["linker.flags"], |
| 559 | } |
| 560 | |
| 561 | cc_defaults { |
| 562 | name: "linux_bionic_supported", |
| 563 | host_supported: true, |
| 564 | target: { |
| 565 | host: { |
| 566 | enabled: false, |
| 567 | }, |
| 568 | linux_bionic: { |
| 569 | enabled: true, |
| 570 | }, |
| 571 | }, |
| 572 | } |
| 573 | ` |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 574 | } |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 575 | |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 576 | func withoutLinuxBionic() string { |
| 577 | return ` |
Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 578 | cc_defaults { |
| 579 | name: "linux_bionic_supported", |
| 580 | } |
| 581 | ` |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 582 | } |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 583 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 584 | func GatherRequiredFilesForTest(fs map[string][]byte) { |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 585 | } |
| 586 | |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 587 | // The directory in which cc linux bionic default modules will be defined. |
| 588 | // |
| 589 | // Placing them here ensures that their location does not conflict with default test modules |
| 590 | // defined by other packages. |
| 591 | const linuxBionicDefaultsPath = "defaults/cc/linux-bionic/Android.bp" |
| 592 | |
| 593 | // The directory in which the default cc common test modules will be defined. |
| 594 | // |
| 595 | // Placing them here ensures that their location does not conflict with default test modules |
| 596 | // defined by other packages. |
| 597 | const DefaultCcCommonTestModulesDir = "defaults/cc/common/" |
| 598 | |
| 599 | // Test fixture preparer that will register most cc build components. |
| 600 | // |
| 601 | // Singletons and mutators should only be added here if they are needed for a majority of cc |
| 602 | // module types, otherwise they should be added under a separate preparer to allow them to be |
| 603 | // selected only when needed to reduce test execution time. |
| 604 | // |
| 605 | // Module types do not have much of an overhead unless they are used so this should include as many |
| 606 | // module types as possible. The exceptions are those module types that require mutators and/or |
| 607 | // singletons in order to function in which case they should be kept together in a separate |
| 608 | // preparer. |
| 609 | var PrepareForTestWithCcBuildComponents = android.GroupFixturePreparers( |
| 610 | android.PrepareForTestWithAndroidBuildComponents, |
| 611 | android.FixtureRegisterWithContext(RegisterRequiredBuildComponentsForTest), |
| 612 | android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) { |
| 613 | ctx.RegisterModuleType("cc_fuzz", FuzzFactory) |
| 614 | ctx.RegisterModuleType("cc_test", TestFactory) |
| 615 | ctx.RegisterModuleType("cc_test_library", TestLibraryFactory) |
| 616 | ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) |
| 617 | ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) |
| 618 | ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) |
| 619 | |
| 620 | RegisterVndkLibraryTxtTypes(ctx) |
| 621 | }), |
| 622 | ) |
| 623 | |
| 624 | // Preparer that will define default cc modules, e.g. standard prebuilt modules. |
| 625 | var PrepareForTestWithCcDefaultModules = android.GroupFixturePreparers( |
| 626 | PrepareForTestWithCcBuildComponents, |
| 627 | // Place the default cc test modules that are common to all platforms in a location that will not |
| 628 | // conflict with default test modules defined by other packages. |
| 629 | android.FixtureAddTextFile(DefaultCcCommonTestModulesDir+"Android.bp", commonDefaultModules()), |
| 630 | // Disable linux bionic by default. |
| 631 | android.FixtureAddTextFile(linuxBionicDefaultsPath, withoutLinuxBionic()), |
| 632 | ) |
| 633 | |
| 634 | // Prepare a fixture to use all cc module types, mutators and singletons fully. |
| 635 | // |
| 636 | // This should only be used by tests that want to run with as much of the build enabled as possible. |
| 637 | var PrepareForIntegrationTestWithCc = android.GroupFixturePreparers( |
| 638 | android.PrepareForIntegrationTestWithAndroid, |
| 639 | genrule.PrepareForIntegrationTestWithGenrule, |
| 640 | PrepareForTestWithCcDefaultModules, |
| 641 | ) |
| 642 | |
| 643 | // The preparer to include if running a cc related test for windows. |
| 644 | var PrepareForTestOnWindows = android.GroupFixturePreparers( |
| 645 | // Place the default cc test modules for windows platforms in a location that will not conflict |
| 646 | // with default test modules defined by other packages. |
| 647 | android.FixtureAddTextFile("defaults/cc/windows/Android.bp", withWindowsModules()), |
| 648 | ) |
| 649 | |
| 650 | // The preparer to include if running a cc related test for linux bionic. |
| 651 | var PrepareForTestOnLinuxBionic = android.GroupFixturePreparers( |
| 652 | // Enable linux bionic. |
| 653 | android.FixtureAddTextFile(linuxBionicDefaultsPath, withLinuxBionic()), |
| 654 | ) |
| 655 | |
| 656 | // This adds some additional modules and singletons which might negatively impact the performance |
| 657 | // of tests so they are not included in the PrepareForIntegrationTestWithCc. |
| 658 | var PrepareForTestWithCcIncludeVndk = android.GroupFixturePreparers( |
| 659 | PrepareForIntegrationTestWithCc, |
| 660 | android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) { |
| 661 | vendorSnapshotImageSingleton.init(ctx) |
| 662 | recoverySnapshotImageSingleton.init(ctx) |
| 663 | ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) |
| 664 | }), |
| 665 | ) |
| 666 | |
| 667 | // TestConfig is the legacy way of creating a test Config for testing cc modules. |
| 668 | // |
| 669 | // See testCc for an explanation as to how to stop using this deprecated method. |
| 670 | // |
| 671 | // deprecated |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 672 | func TestConfig(buildDir string, os android.OsType, env map[string]string, |
| 673 | bp string, fs map[string][]byte) android.Config { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 674 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 675 | // add some modules that are required by the compiler and/or linker |
| 676 | bp = bp + GatherRequiredDepsForTest(os) |
| 677 | |
Colin Cross | 2fce23a | 2020-06-07 17:02:48 -0700 | [diff] [blame] | 678 | mockFS := map[string][]byte{} |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 679 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 680 | GatherRequiredFilesForTest(mockFS) |
| 681 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 682 | for k, v := range fs { |
| 683 | mockFS[k] = v |
| 684 | } |
| 685 | |
| 686 | var config android.Config |
| 687 | if os == android.Fuchsia { |
| 688 | config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS) |
| 689 | } else { |
| 690 | config = android.TestArchConfig(buildDir, env, bp, mockFS) |
| 691 | } |
| 692 | |
| 693 | return config |
| 694 | } |
| 695 | |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 696 | // CreateTestContext is the legacy way of creating a TestContext for testing cc modules. |
| 697 | // |
| 698 | // See testCc for an explanation as to how to stop using this deprecated method. |
| 699 | // |
| 700 | // deprecated |
Colin Cross | ae8600b | 2020-10-29 17:09:13 -0700 | [diff] [blame] | 701 | func CreateTestContext(config android.Config) *android.TestContext { |
| 702 | ctx := android.NewTestArchContext(config) |
Paul Duffin | d6ceb86 | 2021-03-04 23:02:31 +0000 | [diff] [blame] | 703 | genrule.RegisterGenruleBuildComponents(ctx) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 704 | ctx.RegisterModuleType("cc_fuzz", FuzzFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 705 | ctx.RegisterModuleType("cc_test", TestFactory) |
Chris Parsons | 79d66a5 | 2020-06-05 17:26:16 -0400 | [diff] [blame] | 706 | ctx.RegisterModuleType("cc_test_library", TestLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 707 | ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) |
| 708 | ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 709 | ctx.RegisterModuleType("filegroup", android.FileGroupFactory) |
| 710 | ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 711 | |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 712 | vendorSnapshotImageSingleton.init(ctx) |
| 713 | recoverySnapshotImageSingleton.init(ctx) |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 714 | ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) |
Colin Cross | e4e44bc | 2020-12-28 13:50:21 -0800 | [diff] [blame] | 715 | RegisterVndkLibraryTxtTypes(ctx) |
Paul Duffin | 02a3d65 | 2021-02-24 18:51:54 +0000 | [diff] [blame^] | 716 | |
Colin Cross | e1bb5d0 | 2019-09-24 14:55:04 -0700 | [diff] [blame] | 717 | ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) |
Paul Duffin | 021f4e5 | 2020-07-30 16:04:17 +0100 | [diff] [blame] | 718 | android.RegisterPrebuiltMutators(ctx) |
Paul Duffin | c988c8e | 2020-04-29 18:27:14 +0100 | [diff] [blame] | 719 | RegisterRequiredBuildComponentsForTest(ctx) |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 720 | |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 721 | return ctx |
| 722 | } |