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" |
| 19 | ) |
| 20 | |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 21 | func RegisterRequiredBuildComponentsForTest(ctx android.RegistrationContext) { |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 22 | RegisterPrebuiltBuildComponents(ctx) |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 23 | android.RegisterPrebuiltMutators(ctx) |
Paul Duffin | 075c417 | 2019-12-19 19:06:13 +0000 | [diff] [blame] | 24 | |
Paul Duffin | 036e700 | 2019-12-19 19:16:28 +0000 | [diff] [blame] | 25 | RegisterCCBuildComponents(ctx) |
Paul Duffin | 2ee6979 | 2020-01-16 12:14:42 +0000 | [diff] [blame] | 26 | RegisterBinaryBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 27 | RegisterLibraryBuildComponents(ctx) |
Paul Duffin | 1c6c1c7 | 2020-02-21 10:28:43 +0000 | [diff] [blame] | 28 | RegisterLibraryHeadersBuildComponents(ctx) |
Paul Duffin | 6c26dc7 | 2019-12-19 15:02:40 +0000 | [diff] [blame] | 29 | |
| 30 | ctx.RegisterModuleType("toolchain_library", ToolchainLibraryFactory) |
| 31 | ctx.RegisterModuleType("llndk_library", LlndkLibraryFactory) |
| 32 | ctx.RegisterModuleType("cc_object", ObjectFactory) |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 33 | ctx.RegisterModuleType("ndk_prebuilt_shared_stl", NdkPrebuiltSharedStlFactory) |
| 34 | ctx.RegisterModuleType("ndk_prebuilt_object", NdkPrebuiltObjectFactory) |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 35 | } |
| 36 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 37 | func GatherRequiredDepsForTest(oses ...android.OsType) string { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 38 | ret := ` |
| 39 | toolchain_library { |
| 40 | name: "libatomic", |
| 41 | vendor_available: true, |
| 42 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 43 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 44 | src: "", |
| 45 | } |
| 46 | |
| 47 | toolchain_library { |
| 48 | name: "libcompiler_rt-extras", |
| 49 | vendor_available: true, |
| 50 | recovery_available: true, |
| 51 | src: "", |
| 52 | } |
| 53 | |
| 54 | toolchain_library { |
| 55 | name: "libclang_rt.builtins-arm-android", |
| 56 | vendor_available: true, |
| 57 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 58 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 59 | src: "", |
| 60 | } |
| 61 | |
| 62 | toolchain_library { |
| 63 | name: "libclang_rt.builtins-aarch64-android", |
| 64 | vendor_available: true, |
| 65 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 66 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 67 | src: "", |
| 68 | } |
| 69 | |
Jooyung Han | 7556839 | 2020-03-20 04:29:24 +0900 | [diff] [blame] | 70 | cc_prebuilt_library_shared { |
| 71 | name: "libclang_rt.hwasan-aarch64-android", |
| 72 | nocrt: true, |
| 73 | vendor_available: true, |
| 74 | recovery_available: true, |
| 75 | system_shared_libs: [], |
| 76 | stl: "none", |
| 77 | srcs: [""], |
| 78 | check_elf_files: false, |
| 79 | sanitize: { |
| 80 | never: true, |
| 81 | }, |
| 82 | } |
| 83 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 84 | toolchain_library { |
| 85 | name: "libclang_rt.builtins-i686-android", |
| 86 | vendor_available: true, |
| 87 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 88 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 89 | src: "", |
| 90 | } |
| 91 | |
| 92 | toolchain_library { |
| 93 | name: "libclang_rt.builtins-x86_64-android", |
| 94 | vendor_available: true, |
| 95 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 96 | native_bridge_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 97 | src: "", |
| 98 | } |
| 99 | |
| 100 | toolchain_library { |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 101 | name: "libclang_rt.fuzzer-arm-android", |
| 102 | vendor_available: true, |
| 103 | recovery_available: true, |
| 104 | src: "", |
| 105 | } |
| 106 | |
| 107 | toolchain_library { |
| 108 | name: "libclang_rt.fuzzer-aarch64-android", |
| 109 | vendor_available: true, |
| 110 | recovery_available: true, |
| 111 | src: "", |
| 112 | } |
| 113 | |
| 114 | toolchain_library { |
| 115 | name: "libclang_rt.fuzzer-i686-android", |
| 116 | vendor_available: true, |
| 117 | recovery_available: true, |
| 118 | src: "", |
| 119 | } |
| 120 | |
| 121 | toolchain_library { |
| 122 | name: "libclang_rt.fuzzer-x86_64-android", |
| 123 | vendor_available: true, |
| 124 | recovery_available: true, |
| 125 | src: "", |
| 126 | } |
| 127 | |
| 128 | toolchain_library { |
| 129 | name: "libclang_rt.fuzzer-x86_64", |
| 130 | vendor_available: true, |
| 131 | recovery_available: true, |
| 132 | src: "", |
| 133 | } |
| 134 | |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 135 | // Needed for sanitizer |
| 136 | cc_prebuilt_library_shared { |
| 137 | name: "libclang_rt.ubsan_standalone-aarch64-android", |
| 138 | vendor_available: true, |
| 139 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 140 | system_shared_libs: [], |
Paul Duffin | d686791 | 2019-12-19 14:38:36 +0000 | [diff] [blame] | 141 | srcs: [""], |
| 142 | } |
| 143 | |
Mitch Phillips | da9a463 | 2019-07-15 09:34:09 -0700 | [diff] [blame] | 144 | toolchain_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 145 | name: "libgcc", |
| 146 | vendor_available: true, |
| 147 | recovery_available: true, |
| 148 | src: "", |
| 149 | } |
| 150 | |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 151 | toolchain_library { |
| 152 | name: "libgcc_stripped", |
| 153 | vendor_available: true, |
| 154 | recovery_available: true, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 155 | sdk_version: "current", |
Yi Kong | acee27c | 2019-03-29 20:05:14 -0700 | [diff] [blame] | 156 | src: "", |
| 157 | } |
| 158 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 159 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 160 | name: "libc", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 161 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 162 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 163 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 164 | system_shared_libs: [], |
| 165 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 166 | stubs: { |
| 167 | versions: ["27", "28", "29"], |
| 168 | }, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 169 | } |
| 170 | llndk_library { |
| 171 | name: "libc", |
| 172 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 173 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 174 | } |
| 175 | cc_library { |
| 176 | name: "libm", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 177 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 178 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 179 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 180 | system_shared_libs: [], |
| 181 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 182 | stubs: { |
| 183 | versions: ["27", "28", "29"], |
| 184 | }, |
| 185 | apex_available: [ |
| 186 | "//apex_available:platform", |
| 187 | "myapex" |
| 188 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 189 | } |
| 190 | llndk_library { |
| 191 | name: "libm", |
| 192 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 193 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 194 | } |
| 195 | cc_library { |
| 196 | name: "libdl", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 197 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 198 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 199 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 200 | system_shared_libs: [], |
| 201 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 202 | stubs: { |
| 203 | versions: ["27", "28", "29"], |
| 204 | }, |
| 205 | apex_available: [ |
| 206 | "//apex_available:platform", |
| 207 | "myapex" |
| 208 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 209 | } |
| 210 | llndk_library { |
| 211 | name: "libdl", |
| 212 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 213 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 214 | } |
| 215 | cc_library { |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 216 | name: "libft2", |
| 217 | no_libcrt: true, |
| 218 | nocrt: true, |
| 219 | system_shared_libs: [], |
| 220 | recovery_available: true, |
| 221 | } |
| 222 | llndk_library { |
| 223 | name: "libft2", |
| 224 | symbol_file: "", |
| 225 | vendor_available: false, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 226 | sdk_version: "current", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 227 | } |
| 228 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 229 | name: "libc++_static", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 230 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 231 | nocrt: true, |
| 232 | system_shared_libs: [], |
| 233 | stl: "none", |
| 234 | vendor_available: true, |
| 235 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 236 | host_supported: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 237 | apex_available: [ |
| 238 | "//apex_available:platform", |
| 239 | "//apex_available:anyapex", |
| 240 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 241 | } |
| 242 | cc_library { |
| 243 | name: "libc++", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 244 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 245 | nocrt: true, |
| 246 | system_shared_libs: [], |
| 247 | stl: "none", |
| 248 | vendor_available: true, |
| 249 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 250 | host_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 251 | vndk: { |
| 252 | enabled: true, |
| 253 | support_system_process: true, |
| 254 | }, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 255 | apex_available: [ |
| 256 | "//apex_available:platform", |
| 257 | "myapex" |
| 258 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 259 | } |
| 260 | cc_library { |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 261 | name: "libc++demangle", |
| 262 | no_libcrt: true, |
| 263 | nocrt: true, |
| 264 | system_shared_libs: [], |
| 265 | stl: "none", |
| 266 | host_supported: false, |
| 267 | vendor_available: true, |
| 268 | recovery_available: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 269 | apex_available: [ |
| 270 | "//apex_available:platform", |
| 271 | "//apex_available:anyapex", |
| 272 | ], |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 273 | } |
| 274 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 275 | name: "libunwind_llvm", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 276 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 277 | nocrt: true, |
| 278 | system_shared_libs: [], |
| 279 | stl: "none", |
| 280 | vendor_available: true, |
| 281 | recovery_available: true, |
| 282 | } |
| 283 | |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 284 | cc_defaults { |
| 285 | name: "crt_defaults", |
| 286 | recovery_available: true, |
| 287 | vendor_available: true, |
| 288 | native_bridge_supported: true, |
| 289 | stl: "none", |
| 290 | apex_available: [ |
| 291 | "//apex_available:platform", |
| 292 | "//apex_available:anyapex", |
| 293 | ], |
| 294 | } |
| 295 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 296 | cc_object { |
| 297 | name: "crtbegin_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 298 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 299 | recovery_available: true, |
| 300 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 301 | native_bridge_supported: true, |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 302 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | cc_object { |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 306 | name: "crtbegin_dynamic", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 307 | defaults: ["crt_defaults"], |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 308 | recovery_available: true, |
| 309 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 310 | native_bridge_supported: true, |
| 311 | stl: "none", |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 312 | } |
| 313 | |
| 314 | cc_object { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 315 | name: "crtbegin_static", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 316 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 317 | recovery_available: true, |
| 318 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 319 | native_bridge_supported: true, |
| 320 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | cc_object { |
| 324 | name: "crtend_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 325 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 326 | recovery_available: true, |
| 327 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 328 | native_bridge_supported: true, |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 329 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | cc_object { |
| 333 | name: "crtend_android", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 334 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 335 | recovery_available: true, |
| 336 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 337 | native_bridge_supported: true, |
| 338 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 339 | } |
| 340 | |
| 341 | cc_library { |
| 342 | name: "libprotobuf-cpp-lite", |
| 343 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 344 | |
| 345 | cc_library { |
| 346 | name: "ndk_libunwind", |
| 347 | sdk_version: "current", |
| 348 | stl: "none", |
| 349 | system_shared_libs: [], |
| 350 | } |
| 351 | |
| 352 | cc_library { |
| 353 | name: "libc.ndk.current", |
| 354 | sdk_version: "current", |
| 355 | stl: "none", |
| 356 | system_shared_libs: [], |
| 357 | } |
| 358 | |
| 359 | cc_library { |
| 360 | name: "libm.ndk.current", |
| 361 | sdk_version: "current", |
| 362 | stl: "none", |
| 363 | system_shared_libs: [], |
| 364 | } |
| 365 | |
| 366 | cc_library { |
| 367 | name: "libdl.ndk.current", |
| 368 | sdk_version: "current", |
| 369 | stl: "none", |
| 370 | system_shared_libs: [], |
| 371 | } |
| 372 | |
| 373 | ndk_prebuilt_object { |
| 374 | name: "ndk_crtbegin_so.27", |
| 375 | sdk_version: "27", |
| 376 | } |
| 377 | |
| 378 | ndk_prebuilt_object { |
| 379 | name: "ndk_crtend_so.27", |
| 380 | sdk_version: "27", |
| 381 | } |
| 382 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 383 | ndk_prebuilt_object { |
| 384 | name: "ndk_crtbegin_dynamic.27", |
| 385 | sdk_version: "27", |
| 386 | } |
| 387 | |
| 388 | ndk_prebuilt_object { |
| 389 | name: "ndk_crtend_android.27", |
| 390 | sdk_version: "27", |
| 391 | } |
| 392 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 393 | ndk_prebuilt_shared_stl { |
| 394 | name: "ndk_libc++_shared", |
| 395 | } |
| 396 | ` |
| 397 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 398 | for _, os := range oses { |
| 399 | if os == android.Fuchsia { |
| 400 | ret += ` |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 401 | cc_library { |
| 402 | name: "libbioniccompat", |
| 403 | stl: "none", |
| 404 | } |
| 405 | cc_library { |
| 406 | name: "libcompiler_rt", |
| 407 | stl: "none", |
| 408 | } |
| 409 | ` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 410 | } |
| 411 | if os == android.Windows { |
| 412 | ret += ` |
| 413 | toolchain_library { |
| 414 | name: "libwinpthread", |
| 415 | host_supported: true, |
| 416 | enabled: false, |
| 417 | target: { |
| 418 | windows: { |
| 419 | enabled: true, |
| 420 | }, |
| 421 | }, |
| 422 | src: "", |
| 423 | } |
| 424 | ` |
| 425 | } |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 426 | } |
| 427 | return ret |
| 428 | } |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 429 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 430 | func GatherRequiredFilesForTest(fs map[string][]byte) { |
| 431 | fs["prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so"] = nil |
| 432 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtbegin_so.o"] = nil |
| 433 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtend_so.o"] = nil |
| 434 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtbegin_so.o"] = nil |
| 435 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtend_so.o"] = nil |
| 436 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtbegin_so.o"] = nil |
| 437 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtend_so.o"] = nil |
| 438 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtbegin_so.o"] = nil |
| 439 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtend_so.o"] = nil |
| 440 | } |
| 441 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 442 | func TestConfig(buildDir string, os android.OsType, env map[string]string, |
| 443 | bp string, fs map[string][]byte) android.Config { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 444 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 445 | // add some modules that are required by the compiler and/or linker |
| 446 | bp = bp + GatherRequiredDepsForTest(os) |
| 447 | |
| 448 | mockFS := map[string][]byte{ |
| 449 | "foo.c": nil, |
| 450 | "foo.lds": nil, |
| 451 | "bar.c": nil, |
| 452 | "baz.c": nil, |
| 453 | "baz.o": nil, |
| 454 | "a.proto": nil, |
| 455 | "b.aidl": nil, |
| 456 | "sub/c.aidl": nil, |
| 457 | "my_include": nil, |
| 458 | "foo.map.txt": nil, |
| 459 | "liba.so": nil, |
| 460 | } |
| 461 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 462 | GatherRequiredFilesForTest(mockFS) |
| 463 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 464 | for k, v := range fs { |
| 465 | mockFS[k] = v |
| 466 | } |
| 467 | |
| 468 | var config android.Config |
| 469 | if os == android.Fuchsia { |
| 470 | config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS) |
| 471 | } else { |
| 472 | config = android.TestArchConfig(buildDir, env, bp, mockFS) |
| 473 | } |
| 474 | |
| 475 | return config |
| 476 | } |
| 477 | |
| 478 | func CreateTestContext() *android.TestContext { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 479 | ctx := android.NewTestArchContext() |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 480 | ctx.RegisterModuleType("cc_fuzz", FuzzFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 481 | ctx.RegisterModuleType("cc_test", TestFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 482 | ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) |
Jooyung Han | b90e491 | 2019-12-09 18:21:48 +0900 | [diff] [blame] | 483 | ctx.RegisterModuleType("ndk_library", NdkLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 484 | ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 485 | ctx.RegisterModuleType("filegroup", android.FileGroupFactory) |
| 486 | ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) |
| 487 | ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) |
Colin Cross | e1bb5d0 | 2019-09-24 14:55:04 -0700 | [diff] [blame] | 488 | ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) |
Paul Duffin | c988c8e | 2020-04-29 18:27:14 +0100 | [diff] [blame^] | 489 | RegisterRequiredBuildComponentsForTest(ctx) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 490 | ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) |
Inseob Kim | 8471cda | 2019-11-15 09:59:12 +0900 | [diff] [blame] | 491 | ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton) |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 492 | |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 493 | return ctx |
| 494 | } |