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