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 | } |
Ivan Lozano | a0cd8f9 | 2020-04-09 09:56:02 -0400 | [diff] [blame^] | 195 | |
| 196 | // Coverage libraries |
| 197 | cc_library { |
| 198 | name: "libprofile-extras", |
| 199 | vendor_available: true, |
| 200 | recovery_available: true, |
| 201 | native_coverage: false, |
| 202 | system_shared_libs: [], |
| 203 | stl: "none", |
| 204 | notice: "custom_notice", |
| 205 | } |
| 206 | cc_library { |
| 207 | name: "libprofile-clang-extras", |
| 208 | vendor_available: true, |
| 209 | recovery_available: true, |
| 210 | native_coverage: false, |
| 211 | system_shared_libs: [], |
| 212 | stl: "none", |
| 213 | notice: "custom_notice", |
| 214 | } |
| 215 | cc_library { |
| 216 | name: "libprofile-extras_ndk", |
| 217 | vendor_available: true, |
| 218 | native_coverage: false, |
| 219 | system_shared_libs: [], |
| 220 | stl: "none", |
| 221 | notice: "custom_notice", |
| 222 | sdk_version: "current", |
| 223 | } |
| 224 | cc_library { |
| 225 | name: "libprofile-clang-extras_ndk", |
| 226 | vendor_available: true, |
| 227 | native_coverage: false, |
| 228 | system_shared_libs: [], |
| 229 | stl: "none", |
| 230 | notice: "custom_notice", |
| 231 | sdk_version: "current", |
| 232 | } |
| 233 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 234 | cc_library { |
| 235 | name: "libdl", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 236 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 237 | nocrt: true, |
Peter Collingbourne | e5ba286 | 2019-12-10 18:37:45 -0800 | [diff] [blame] | 238 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 239 | system_shared_libs: [], |
| 240 | recovery_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 241 | stubs: { |
| 242 | versions: ["27", "28", "29"], |
| 243 | }, |
| 244 | apex_available: [ |
| 245 | "//apex_available:platform", |
| 246 | "myapex" |
| 247 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 248 | } |
| 249 | llndk_library { |
| 250 | name: "libdl", |
| 251 | symbol_file: "", |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 252 | sdk_version: "current", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 253 | } |
| 254 | cc_library { |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 255 | name: "libft2", |
| 256 | no_libcrt: true, |
| 257 | nocrt: true, |
| 258 | system_shared_libs: [], |
| 259 | recovery_available: true, |
| 260 | } |
| 261 | llndk_library { |
| 262 | name: "libft2", |
| 263 | symbol_file: "", |
| 264 | vendor_available: false, |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 265 | sdk_version: "current", |
Jooyung Han | 097087b | 2019-10-22 19:32:18 +0900 | [diff] [blame] | 266 | } |
| 267 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 268 | name: "libc++_static", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 269 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 270 | nocrt: true, |
| 271 | system_shared_libs: [], |
| 272 | stl: "none", |
| 273 | vendor_available: true, |
| 274 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 275 | host_supported: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 276 | apex_available: [ |
| 277 | "//apex_available:platform", |
| 278 | "//apex_available:anyapex", |
| 279 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 280 | } |
| 281 | cc_library { |
| 282 | name: "libc++", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 283 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 284 | nocrt: true, |
| 285 | system_shared_libs: [], |
| 286 | stl: "none", |
| 287 | vendor_available: true, |
| 288 | recovery_available: true, |
Inseob Kim | 89db15d | 2020-02-03 18:06:46 +0900 | [diff] [blame] | 289 | host_supported: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 290 | vndk: { |
| 291 | enabled: true, |
| 292 | support_system_process: true, |
| 293 | }, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 294 | apex_available: [ |
| 295 | "//apex_available:platform", |
| 296 | "myapex" |
| 297 | ], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 298 | } |
| 299 | cc_library { |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 300 | name: "libc++demangle", |
| 301 | no_libcrt: true, |
| 302 | nocrt: true, |
| 303 | system_shared_libs: [], |
| 304 | stl: "none", |
| 305 | host_supported: false, |
| 306 | vendor_available: true, |
| 307 | recovery_available: true, |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 308 | apex_available: [ |
| 309 | "//apex_available:platform", |
| 310 | "//apex_available:anyapex", |
| 311 | ], |
Dan Albert | 2da19cb | 2019-07-24 12:17:40 -0700 | [diff] [blame] | 312 | } |
| 313 | cc_library { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 314 | name: "libunwind_llvm", |
Yi Kong | e7fe991 | 2019-06-02 00:53:50 -0700 | [diff] [blame] | 315 | no_libcrt: true, |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 316 | nocrt: true, |
| 317 | system_shared_libs: [], |
| 318 | stl: "none", |
| 319 | vendor_available: true, |
| 320 | recovery_available: true, |
| 321 | } |
| 322 | |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 323 | cc_defaults { |
| 324 | name: "crt_defaults", |
| 325 | recovery_available: true, |
| 326 | vendor_available: true, |
| 327 | native_bridge_supported: true, |
| 328 | stl: "none", |
| 329 | apex_available: [ |
| 330 | "//apex_available:platform", |
| 331 | "//apex_available:anyapex", |
| 332 | ], |
| 333 | } |
| 334 | |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 335 | cc_object { |
| 336 | name: "crtbegin_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 337 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 338 | recovery_available: true, |
| 339 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 340 | native_bridge_supported: true, |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 341 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | cc_object { |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 345 | name: "crtbegin_dynamic", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 346 | defaults: ["crt_defaults"], |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 347 | recovery_available: true, |
| 348 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 349 | native_bridge_supported: true, |
| 350 | stl: "none", |
Colin Cross | 815daf9 | 2019-05-14 16:05:20 -0700 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | cc_object { |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 354 | name: "crtbegin_static", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 355 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 356 | recovery_available: true, |
| 357 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 358 | native_bridge_supported: true, |
| 359 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 360 | } |
| 361 | |
| 362 | cc_object { |
| 363 | name: "crtend_so", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 364 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 365 | recovery_available: true, |
| 366 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 367 | native_bridge_supported: true, |
Jiyong Park | a7bc8ad | 2019-10-15 15:20:07 +0900 | [diff] [blame] | 368 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | cc_object { |
| 372 | name: "crtend_android", |
Jiyong Park | 541142c | 2020-03-07 16:35:46 +0900 | [diff] [blame] | 373 | defaults: ["crt_defaults"], |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 374 | recovery_available: true, |
| 375 | vendor_available: true, |
Colin Cross | f9aabd7 | 2020-02-15 11:29:50 -0800 | [diff] [blame] | 376 | native_bridge_supported: true, |
| 377 | stl: "none", |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | cc_library { |
| 381 | name: "libprotobuf-cpp-lite", |
| 382 | } |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 383 | |
| 384 | cc_library { |
| 385 | name: "ndk_libunwind", |
| 386 | sdk_version: "current", |
| 387 | stl: "none", |
| 388 | system_shared_libs: [], |
| 389 | } |
| 390 | |
| 391 | cc_library { |
| 392 | name: "libc.ndk.current", |
| 393 | sdk_version: "current", |
| 394 | stl: "none", |
| 395 | system_shared_libs: [], |
| 396 | } |
| 397 | |
| 398 | cc_library { |
| 399 | name: "libm.ndk.current", |
| 400 | sdk_version: "current", |
| 401 | stl: "none", |
| 402 | system_shared_libs: [], |
| 403 | } |
| 404 | |
| 405 | cc_library { |
| 406 | name: "libdl.ndk.current", |
| 407 | sdk_version: "current", |
| 408 | stl: "none", |
| 409 | system_shared_libs: [], |
| 410 | } |
| 411 | |
| 412 | ndk_prebuilt_object { |
| 413 | name: "ndk_crtbegin_so.27", |
| 414 | sdk_version: "27", |
| 415 | } |
| 416 | |
| 417 | ndk_prebuilt_object { |
| 418 | name: "ndk_crtend_so.27", |
| 419 | sdk_version: "27", |
| 420 | } |
| 421 | |
Colin Cross | c511bc5 | 2020-04-07 16:50:32 +0000 | [diff] [blame] | 422 | ndk_prebuilt_object { |
| 423 | name: "ndk_crtbegin_dynamic.27", |
| 424 | sdk_version: "27", |
| 425 | } |
| 426 | |
| 427 | ndk_prebuilt_object { |
| 428 | name: "ndk_crtend_android.27", |
| 429 | sdk_version: "27", |
| 430 | } |
| 431 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 432 | ndk_prebuilt_shared_stl { |
| 433 | name: "ndk_libc++_shared", |
| 434 | } |
| 435 | ` |
| 436 | |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 437 | for _, os := range oses { |
| 438 | if os == android.Fuchsia { |
| 439 | ret += ` |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 440 | cc_library { |
| 441 | name: "libbioniccompat", |
| 442 | stl: "none", |
| 443 | } |
| 444 | cc_library { |
| 445 | name: "libcompiler_rt", |
| 446 | stl: "none", |
| 447 | } |
| 448 | ` |
Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 449 | } |
| 450 | if os == android.Windows { |
| 451 | ret += ` |
| 452 | toolchain_library { |
| 453 | name: "libwinpthread", |
| 454 | host_supported: true, |
| 455 | enabled: false, |
| 456 | target: { |
| 457 | windows: { |
| 458 | enabled: true, |
| 459 | }, |
| 460 | }, |
| 461 | src: "", |
| 462 | } |
| 463 | ` |
| 464 | } |
Inseob Kim | c0907f1 | 2019-02-08 21:00:45 +0900 | [diff] [blame] | 465 | } |
| 466 | return ret |
| 467 | } |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 468 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 469 | func GatherRequiredFilesForTest(fs map[string][]byte) { |
| 470 | fs["prebuilts/ndk/current/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so"] = nil |
| 471 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtbegin_so.o"] = nil |
| 472 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm/usr/lib/crtend_so.o"] = nil |
| 473 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtbegin_so.o"] = nil |
| 474 | fs["prebuilts/ndk/current/platforms/android-27/arch-arm64/usr/lib/crtend_so.o"] = nil |
| 475 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtbegin_so.o"] = nil |
| 476 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86/usr/lib/crtend_so.o"] = nil |
| 477 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtbegin_so.o"] = nil |
| 478 | fs["prebuilts/ndk/current/platforms/android-27/arch-x86_64/usr/lib64/crtend_so.o"] = nil |
| 479 | } |
| 480 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 481 | func TestConfig(buildDir string, os android.OsType, env map[string]string, |
| 482 | bp string, fs map[string][]byte) android.Config { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 483 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 484 | // add some modules that are required by the compiler and/or linker |
| 485 | bp = bp + GatherRequiredDepsForTest(os) |
| 486 | |
| 487 | mockFS := map[string][]byte{ |
| 488 | "foo.c": nil, |
| 489 | "foo.lds": nil, |
| 490 | "bar.c": nil, |
| 491 | "baz.c": nil, |
| 492 | "baz.o": nil, |
| 493 | "a.proto": nil, |
| 494 | "b.aidl": nil, |
| 495 | "sub/c.aidl": nil, |
| 496 | "my_include": nil, |
| 497 | "foo.map.txt": nil, |
| 498 | "liba.so": nil, |
| 499 | } |
| 500 | |
Colin Cross | f28329d | 2020-02-15 11:00:10 -0800 | [diff] [blame] | 501 | GatherRequiredFilesForTest(mockFS) |
| 502 | |
Colin Cross | 98be1bb | 2019-12-13 20:41:13 -0800 | [diff] [blame] | 503 | for k, v := range fs { |
| 504 | mockFS[k] = v |
| 505 | } |
| 506 | |
| 507 | var config android.Config |
| 508 | if os == android.Fuchsia { |
| 509 | config = android.TestArchConfigFuchsia(buildDir, env, bp, mockFS) |
| 510 | } else { |
| 511 | config = android.TestArchConfig(buildDir, env, bp, mockFS) |
| 512 | } |
| 513 | |
| 514 | return config |
| 515 | } |
| 516 | |
| 517 | func CreateTestContext() *android.TestContext { |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 518 | ctx := android.NewTestArchContext() |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 519 | ctx.RegisterModuleType("cc_fuzz", FuzzFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 520 | ctx.RegisterModuleType("cc_test", TestFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 521 | ctx.RegisterModuleType("llndk_headers", llndkHeadersFactory) |
Jooyung Han | b90e491 | 2019-12-09 18:21:48 +0900 | [diff] [blame] | 522 | ctx.RegisterModuleType("ndk_library", NdkLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 523 | ctx.RegisterModuleType("vendor_public_library", vendorPublicLibraryFactory) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 524 | ctx.RegisterModuleType("filegroup", android.FileGroupFactory) |
| 525 | ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory) |
| 526 | ctx.RegisterModuleType("vndk_libraries_txt", VndkLibrariesTxtFactory) |
Paul Duffin | 77980a8 | 2019-12-19 16:01:36 +0000 | [diff] [blame] | 527 | RegisterRequiredBuildComponentsForTest(ctx) |
Colin Cross | e1bb5d0 | 2019-09-24 14:55:04 -0700 | [diff] [blame] | 528 | ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators) |
Colin Cross | 4b49b76 | 2019-11-22 15:25:03 -0800 | [diff] [blame] | 529 | ctx.RegisterSingletonType("vndk-snapshot", VndkSnapshotSingleton) |
Inseob Kim | 8471cda | 2019-11-15 09:59:12 +0900 | [diff] [blame] | 530 | ctx.RegisterSingletonType("vendor-snapshot", VendorSnapshotSingleton) |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 531 | |
Colin Cross | 9a94287 | 2019-05-14 15:44:26 -0700 | [diff] [blame] | 532 | return ctx |
| 533 | } |