Enable genrule modules for Rust host binaries
* Add HostToolPath to use rust_binary_host modules as host tools.
Bug: 157666974
Test: make with local genrule examples
Change-Id: I9648313c0f0695d2e695f18ded4710350b2d6475
diff --git a/rust/rust.go b/rust/rust.go
index 03efb75..6c60348 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -886,6 +886,18 @@
return name
}
+var _ android.HostToolProvider = (*Module)(nil)
+
+func (mod *Module) HostToolPath() android.OptionalPath {
+ if !mod.Host() {
+ return android.OptionalPath{}
+ }
+ if _, ok := mod.compiler.(*binaryDecorator); ok {
+ return mod.outputFile
+ }
+ return android.OptionalPath{}
+}
+
var Bool = proptools.Bool
var BoolDefault = proptools.BoolDefault
var String = proptools.String