diff options
Diffstat (limited to 'rust/testing.go')
-rw-r--r-- | rust/testing.go | 100 |
1 files changed, 48 insertions, 52 deletions
diff --git a/rust/testing.go b/rust/testing.go index f9adec828..430b40bfd 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -17,58 +17,31 @@ package rust import ( "android/soong/android" "android/soong/cc" + "android/soong/genrule" ) func GatherRequiredDepsForTest() string { bp := ` - rust_prebuilt_dylib { - name: "libarena_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libfmt_macros_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libgraphviz_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libserialize_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { + rust_prebuilt_library { name: "libstd_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libsyntax_x86_64-unknown-linux-gnu", - srcs: [""], + crate_name: "std", + rlib: { + srcs: ["libstd.rlib"], + }, + dylib: { + srcs: ["libstd.so"], + }, host_supported: true, } - rust_prebuilt_dylib { - name: "libsyntax_ext_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libsyntax_pos_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { - name: "libterm_x86_64-unknown-linux-gnu", - srcs: [""], - host_supported: true, - } - rust_prebuilt_dylib { + rust_prebuilt_library { name: "libtest_x86_64-unknown-linux-gnu", - srcs: [""], + crate_name: "test", + rlib: { + srcs: ["libtest.rlib"], + }, + dylib: { + srcs: ["libtest.so"], + }, host_supported: true, } @@ -81,6 +54,23 @@ func GatherRequiredDepsForTest() string { nocrt: true, system_shared_libs: [], } + rust_library { + name: "libstd", + crate_name: "std", + srcs: ["foo.rs"], + no_stdlibs: true, + host_supported: true, + native_coverage: false, + } + rust_library { + name: "libtest", + crate_name: "test", + srcs: ["foo.rs"], + no_stdlibs: true, + host_supported: true, + native_coverage: false, + } + ` + cc.GatherRequiredDepsForTest(android.NoOsType) return bp } @@ -88,27 +78,33 @@ func GatherRequiredDepsForTest() string { func CreateTestContext() *android.TestContext { ctx := android.NewTestArchContext() cc.RegisterRequiredBuildComponentsForTest(ctx) + ctx.RegisterModuleType("genrule", genrule.GenRuleFactory) ctx.RegisterModuleType("rust_binary", RustBinaryFactory) ctx.RegisterModuleType("rust_binary_host", RustBinaryHostFactory) ctx.RegisterModuleType("rust_test", RustTestFactory) ctx.RegisterModuleType("rust_test_host", RustTestHostFactory) ctx.RegisterModuleType("rust_library", RustLibraryFactory) + ctx.RegisterModuleType("rust_library_dylib", RustLibraryDylibFactory) + ctx.RegisterModuleType("rust_library_rlib", RustLibraryRlibFactory) ctx.RegisterModuleType("rust_library_host", RustLibraryHostFactory) - ctx.RegisterModuleType("rust_library_host_rlib", RustLibraryRlibHostFactory) ctx.RegisterModuleType("rust_library_host_dylib", RustLibraryDylibHostFactory) - ctx.RegisterModuleType("rust_library_rlib", RustLibraryRlibFactory) - ctx.RegisterModuleType("rust_library_dylib", RustLibraryDylibFactory) - ctx.RegisterModuleType("rust_library_shared", RustLibrarySharedFactory) - ctx.RegisterModuleType("rust_library_static", RustLibraryStaticFactory) - ctx.RegisterModuleType("rust_library_host_shared", RustLibrarySharedHostFactory) - ctx.RegisterModuleType("rust_library_host_static", RustLibraryStaticHostFactory) + ctx.RegisterModuleType("rust_library_host_rlib", RustLibraryRlibHostFactory) + ctx.RegisterModuleType("rust_ffi", RustFFIFactory) + ctx.RegisterModuleType("rust_ffi_shared", RustFFISharedFactory) + ctx.RegisterModuleType("rust_ffi_static", RustFFIStaticFactory) + ctx.RegisterModuleType("rust_ffi_host", RustFFIHostFactory) + ctx.RegisterModuleType("rust_ffi_host_shared", RustFFISharedHostFactory) + ctx.RegisterModuleType("rust_ffi_host_static", RustFFIStaticHostFactory) ctx.RegisterModuleType("rust_proc_macro", ProcMacroFactory) + ctx.RegisterModuleType("rust_prebuilt_library", PrebuiltLibraryFactory) ctx.RegisterModuleType("rust_prebuilt_dylib", PrebuiltDylibFactory) + ctx.RegisterModuleType("rust_prebuilt_rlib", PrebuiltRlibFactory) ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { // rust mutators ctx.BottomUp("rust_libraries", LibraryMutator).Parallel() - ctx.BottomUp("rust_unit_tests", TestPerSrcMutator).Parallel() + ctx.BottomUp("rust_begin", BeginMutator).Parallel() }) + ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton) return ctx } |