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:
Matthew Maurer
2019-10-31 10:44:40 -07:00
parent 940ef19f77
commit 99020b04fb
6 changed files with 66 additions and 7 deletions

View File

@@ -93,6 +93,12 @@ func transformSrctoCrate(ctx android.ModuleContext, main android.Path,
rustcFlags = append(rustcFlags, "--target="+targetTriple)
linkFlags = append(linkFlags, "-target "+targetTriple)
}
// TODO once we have static libraries in the host prebuilt .bp, this
// should be unconditionally added.
if !ctx.Host() {
// If we're on a device build, do not use an implicit sysroot
rustcFlags = append(rustcFlags, "--sysroot=/dev/null")
}
// Collect linker flags
linkFlags = append(linkFlags, flags.GlobalLinkFlags...)
linkFlags = append(linkFlags, flags.LinkFlags...)