HostToolPath should return install path
Bug: 163154468
Test: make; find dependencies of 'Module: sqlite3_bindgen_x86_64'
Change-Id: Id9fc4f1937983bdf7eb1732ed6a8afd5aa3eb24c
diff --git a/rust/binary_test.go b/rust/binary_test.go
index ab2dae1..b9c8698 100644
--- a/rust/binary_test.go
+++ b/rust/binary_test.go
@@ -36,6 +36,11 @@
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Output("fizz-buzz")
fizzBuzzDynamic := ctx.ModuleForTests("fizz-buzz-dynamic", "linux_glibc_x86_64").Output("fizz-buzz-dynamic")
+ path := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Module().(*Module).HostToolPath()
+ if g, w := path.String(), "/host/linux-x86/bin/fizz-buzz"; !strings.Contains(g, w) {
+ t.Errorf("wrong host tool path, expected %q got %q", w, g)
+ }
+
// Do not compile binary modules with the --test flag.
flags := fizzBuzzDynamic.Args["rustcFlags"]
if strings.Contains(flags, "--test") {
diff --git a/rust/rust.go b/rust/rust.go
index edfa5d8..46159c6 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -1057,8 +1057,8 @@
if !mod.Host() {
return android.OptionalPath{}
}
- if _, ok := mod.compiler.(*binaryDecorator); ok {
- return mod.outputFile
+ if binary, ok := mod.compiler.(*binaryDecorator); ok {
+ return android.OptionalPathForPath(binary.baseCompiler.path)
}
return android.OptionalPath{}
}