diff options
author | Ivan Lozano <ivanlozano@google.com> | 2020-09-08 12:46:52 -0400 |
---|---|---|
committer | Ivan Lozano <ivanlozano@google.com> | 2020-09-18 16:35:14 -0400 |
commit | 2b0811310eb79c98966220f2336fbd22bdef4110 (patch) | |
tree | 0f2fe56dc6f1fce7703f3c58c12909e6deef13b5 /rust/testing.go | |
parent | cc79a6f514a89ac70336bd3d774f6857b6fc2e19 (diff) |
rust: Add libstd linkage mutator for rlibs.
The current state of linkage is that device targets always link
libstd dynamically except for rust_ffi_static which requires a static
libstd linkage. However this prevents producing rust_ffi_static
modules which depend on other Rust libraries as those dependencies
will link libstd dynamically and cause a collision. We also want our
rust_test modules to statically link in libstd as well.
This adds a linkage mutator for rlibs that creates a variant for each
libstd linkage. Dependent modules can then select the variant that
matches their linkage of libstd.
Also fixes an issue where installation paths were being generated for
rlibs and static libs even though they weren't being installed. This broke
when adding the linkage mutator as Make would complain about multiple
targets producing the same output.
Bug: 168729404
Test: rust_ffi_static module with other rustlib dependency can be built.
Change-Id: I955b484bf5809e8fc5517750c7f8df82d3ca8895
Diffstat (limited to 'rust/testing.go')
-rw-r--r-- | rust/testing.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/testing.go b/rust/testing.go index 0144c8218..ee303ed02 100644 --- a/rust/testing.go +++ b/rust/testing.go @@ -32,6 +32,7 @@ func GatherRequiredDepsForTest() string { srcs: ["libstd.so"], }, host_supported: true, + sysroot: true, } rust_prebuilt_library { name: "libtest_x86_64-unknown-linux-gnu", @@ -43,6 +44,7 @@ func GatherRequiredDepsForTest() string { srcs: ["libtest.so"], }, host_supported: true, + sysroot: true, } rust_prebuilt_library { name: "libstd_x86_64-apple-darwin", @@ -54,6 +56,7 @@ func GatherRequiredDepsForTest() string { srcs: ["libstd.so"], }, host_supported: true, + sysroot: true, } rust_prebuilt_library { name: "libtest_x86_64-apple-darwin", @@ -65,6 +68,7 @@ func GatherRequiredDepsForTest() string { srcs: ["libtest.so"], }, host_supported: true, + sysroot: true, } ////////////////////////////// // Device module requirements @@ -82,6 +86,7 @@ func GatherRequiredDepsForTest() string { no_stdlibs: true, host_supported: true, native_coverage: false, + sysroot: true, } rust_library { name: "libtest", @@ -90,6 +95,7 @@ func GatherRequiredDepsForTest() string { no_stdlibs: true, host_supported: true, native_coverage: false, + sysroot: true, } rust_library { name: "libprotobuf", @@ -134,6 +140,7 @@ func CreateTestContext() *android.TestContext { ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) { // rust mutators ctx.BottomUp("rust_libraries", LibraryMutator).Parallel() + ctx.BottomUp("rust_stdlinkage", LibstdMutator).Parallel() ctx.BottomUp("rust_begin", BeginMutator).Parallel() }) ctx.RegisterSingletonType("rust_project_generator", rustProjectGeneratorSingleton) |