diff options
author | Matthew Maurer <mmaurer@google.com> | 2020-06-25 00:47:46 -0700 |
---|---|---|
committer | Matthew Maurer <mmaurer@google.com> | 2020-07-01 11:27:12 -0700 |
commit | c761eeca4829c7c5a1ab24569a414219f595ec63 (patch) | |
tree | 7f91ce86119df2de0e0c318b1d543df3a85aa6b8 /rust/testing.go | |
parent | 0f003b18516df3df3fa631ca6d1e21322d0947cf (diff) |
rust: Mutate prebuilt modules dylib/rlib
This change makes it possible to use a single module to provide both
dylib and rlib varieties of a library. This allows the use of libstd and
libtest from a rustlibs property, allowing linkage type to change
for different variants.
Bug: 159718669
Test: cd external crates; mma; m crosvm.experimental
Change-Id: I477c4d2faec63703fdc6dd42ba020747d6a50714
Diffstat (limited to 'rust/testing.go')
-rw-r--r-- | rust/testing.go | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/rust/testing.go b/rust/testing.go index 00cd80798..3d583e197 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -21,14 +21,26 @@ import ( func GatherRequiredDepsForTest() string { bp := ` - rust_prebuilt_dylib { + rust_prebuilt_library { name: "libstd_x86_64-unknown-linux-gnu", - srcs: [""], + crate_name: "std", + rlib: { + srcs: ["libstd.rlib"], + }, + dylib: { + srcs: ["libstd.so"], + }, 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, } @@ -41,34 +53,21 @@ func GatherRequiredDepsForTest() string { nocrt: true, system_shared_libs: [], } - rust_library_dylib { + rust_library { name: "libstd", crate_name: "std", srcs: ["foo.rs"], no_stdlibs: true, host_supported: true, + native_coverage: false, } - rust_library_rlib { - name: "libstd.static", - crate_name: "std", - srcs: ["foo.rs"], - no_stdlibs: true, - host_supported: true, - } - rust_library_dylib { + rust_library { name: "libtest", crate_name: "test", srcs: ["foo.rs"], no_stdlibs: true, host_supported: true, - - } - rust_library_rlib { - name: "libtest.static", - crate_name: "test", - srcs: ["foo.rs"], - no_stdlibs: true, - host_supported: true, + native_coverage: false, } ` + cc.GatherRequiredDepsForTest(android.NoOsType) @@ -95,7 +94,9 @@ func CreateTestContext() *android.TestContext { 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() |