Build Rust Device Sysroots in Soong
In order to ensure we are using current platform Bionic for any platform Rust binaries, we need to build the sysroot in Soong. This will also enable us too hook the "test" crate if necessary. While both a dynamic and static sysroot are available, on device only a dynamic sysroot will be injected. On host, we continue using the sysroot used to build the compiler as before. Bug: 139486496 Change-Id: I127377e5b056610ceb5015a34d266250320fbc31
This commit is contained in:
@@ -209,6 +209,25 @@ func TestProcMacroDeviceDeps(t *testing.T) {
|
||||
name: "libbar",
|
||||
srcs: ["foo.rs"],
|
||||
}
|
||||
// Make a dummy libstd to let resolution go through
|
||||
rust_library_dylib {
|
||||
name: "libstd",
|
||||
crate_name: "std",
|
||||
srcs: ["foo.rs"],
|
||||
no_stdlibs: true,
|
||||
}
|
||||
rust_library_dylib {
|
||||
name: "libterm",
|
||||
crate_name: "term",
|
||||
srcs: ["foo.rs"],
|
||||
no_stdlibs: true,
|
||||
}
|
||||
rust_library_dylib {
|
||||
name: "libtest",
|
||||
crate_name: "test",
|
||||
srcs: ["foo.rs"],
|
||||
no_stdlibs: true,
|
||||
}
|
||||
rust_proc_macro {
|
||||
name: "libpm",
|
||||
rlibs: ["libbar"],
|
||||
@@ -226,3 +245,18 @@ func TestProcMacroDeviceDeps(t *testing.T) {
|
||||
t.Errorf("Proc_macro is not using host variant of dependent modules.")
|
||||
}
|
||||
}
|
||||
|
||||
// Test that no_stdlibs suppresses dependencies on rust standard libraries
|
||||
func TestNoStdlibs(t *testing.T) {
|
||||
ctx := testRust(t, `
|
||||
rust_binary {
|
||||
name: "fizz-buzz",
|
||||
srcs: ["foo.rs"],
|
||||
no_stdlibs: true,
|
||||
}`)
|
||||
module := ctx.ModuleForTests("fizz-buzz", "android_arm64_armv8-a_core").Module().(*Module)
|
||||
|
||||
if android.InList("libstd", module.Properties.AndroidMkDylibs) {
|
||||
t.Errorf("no_stdlibs did not suppress dependency on libstd")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user