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