Expose HostToolPath on the cc module to fix genrule.tool
Bug: 31742855
Test: Use `tool` in a genrule, ensure it runs properly.
Change-Id: Ib9ff35125edd66cdba8ede4f28aa6b753de0689b
diff --git a/cc/binary.go b/cc/binary.go
index 6ad71c6..8afce09 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -69,7 +69,7 @@
Properties BinaryLinkerProperties
- hostToolPath android.OptionalPath
+ toolPath android.OptionalPath
}
var _ linker = (*binaryDecorator)(nil)
@@ -256,9 +256,6 @@
fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
outputFile := android.PathForModuleOut(ctx, fileName)
ret := outputFile
- if ctx.Os().Class == android.Host {
- binary.hostToolPath = android.OptionalPathForPath(outputFile)
- }
var linkerDeps android.Paths
@@ -291,6 +288,13 @@
return ret
}
-func (binary *binaryDecorator) HostToolPath() android.OptionalPath {
- return binary.hostToolPath
+func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
+ binary.baseInstaller.install(ctx, file)
+ if ctx.Os().Class == android.Host {
+ binary.toolPath = android.OptionalPathForPath(binary.baseInstaller.path)
+ }
+}
+
+func (binary *binaryDecorator) hostToolPath() android.OptionalPath {
+ return binary.toolPath
}