summaryrefslogtreecommitdiff
path: root/rust/rust_test.go
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2021-03-23 15:53:44 -0400
committerIvan Lozano <ivanlozano@google.com>2021-03-25 13:50:17 -0400
commit63bb7680c93655bdb54c79dd34b7fea64d85e3d8 (patch)
treea61f55256c59a804f2b7a1a078c34e32422f01d2 /rust/rust_test.go
parent6400f204300c82e37e2cedf696f9f1751c24a049 (diff)
rust: Add whole_static_libs, revert static_lib
Revert the static_lib behavior to the previous behavior (pass static libs to the linker rather than via to rustc using `-lstatic=<lib>`). To bundle static libraries into libraries, provide the whole_static_libs property which retains the current static_libs behavior. Passing all static libraries via -lstatic was resulting in odd bloat where in some cases static symbols were duplicated in binaries and libraries. This split makes it possible to be explicit about when static libraries should be bundled. Bug: 183182230 Test: mma system/bt; mma system/security/keystore2; mma external/rust Change-Id: Ic2dde5d1542dca5ce145aa3a3fbd9ea54440d991
Diffstat (limited to 'rust/rust_test.go')
-rw-r--r--rust/rust_test.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/rust/rust_test.go b/rust/rust_test.go
index bed28ec8f..418bd93a4 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -149,6 +149,11 @@ func TestDepsTracking(t *testing.T) {
srcs: ["foo.rs"],
crate_name: "static",
}
+ rust_ffi_host_static {
+ name: "libwholestatic",
+ srcs: ["foo.rs"],
+ crate_name: "wholestatic",
+ }
rust_ffi_host_shared {
name: "libshared",
srcs: ["foo.rs"],
@@ -164,6 +169,7 @@ func TestDepsTracking(t *testing.T) {
srcs: ["foo.rs"],
crate_name: "rlib",
static_libs: ["libstatic"],
+ whole_static_libs: ["libwholestatic"],
}
rust_proc_macro {
name: "libpm",
@@ -204,8 +210,8 @@ func TestDepsTracking(t *testing.T) {
t.Errorf("Static library dependency not detected (dependency missing from AndroidMkStaticLibs)")
}
- if !strings.Contains(rustc.Args["rustcFlags"], "-lstatic=static") {
- t.Errorf("-lstatic flag not being passed to rustc for static library")
+ if !strings.Contains(rustc.Args["rustcFlags"], "-lstatic=wholestatic") {
+ t.Errorf("-lstatic flag not being passed to rustc for static library %#v", rustc.Args["rustcFlags"])
}
}