diff options
author | 2022-04-07 12:59:11 -0400 | |
---|---|---|
committer | 2022-04-12 11:30:40 -0400 | |
commit | 2d407633ae8fbc0e513c53aa0e70dbb379eed48b (patch) | |
tree | 5770fc0f156dba436de4e73d7304d13be5a5c19d /rust/library_test.go | |
parent | d72c85219a4121d64b4ed7077d87ccdb54351b28 (diff) |
rust: Allow rustlibs to fallback to rlibs.
Allow adding rlib-only libraries to rustlibs by having it fallback to
selecting the rlib variant if a dylib variant is requested but not
available.
Bug: 224771894
Test: m nothing
Test: New Soong test
Change-Id: I47b19ec9dbf3da90a2b090aeda04556a0400c7d1
Diffstat (limited to 'rust/library_test.go')
-rw-r--r-- | rust/library_test.go | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/rust/library_test.go b/rust/library_test.go index d78dcdd97..4633cc7ba 100644 --- a/rust/library_test.go +++ b/rust/library_test.go @@ -200,23 +200,34 @@ func TestStaticLibraryLinkage(t *testing.T) { func TestAutoDeps(t *testing.T) { ctx := testRust(t, ` - rust_library_host { - name: "libbar", - srcs: ["bar.rs"], - crate_name: "bar", - } + rust_library_host { + name: "libbar", + srcs: ["bar.rs"], + crate_name: "bar", + } + rust_library_host_rlib { + name: "librlib_only", + srcs: ["bar.rs"], + crate_name: "rlib_only", + } rust_library_host { name: "libfoo", srcs: ["foo.rs"], crate_name: "foo", - rustlibs: ["libbar"], + rustlibs: [ + "libbar", + "librlib_only", + ], } - rust_ffi_host { - name: "libfoo.ffi", - srcs: ["foo.rs"], - crate_name: "foo", - rustlibs: ["libbar"], - }`) + rust_ffi_host { + name: "libfoo.ffi", + srcs: ["foo.rs"], + crate_name: "foo", + rustlibs: [ + "libbar", + "librlib_only", + ], + }`) libfooRlib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_rlib_rlib-std") libfooDylib := ctx.ModuleForTests("libfoo", "linux_glibc_x86_64_dylib") @@ -239,7 +250,9 @@ func TestAutoDeps(t *testing.T) { if android.InList("libbar.dylib-std", dyn.Module().(*Module).Properties.AndroidMkRlibs) { t.Errorf("libbar present as rlib dependency in dynamic lib") } - + if !android.InList("librlib_only.dylib-std", dyn.Module().(*Module).Properties.AndroidMkRlibs) { + t.Errorf("librlib_only should be selected by rustlibs as an rlib.") + } } } |