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
This commit is contained in:
16
cc/binary.go
16
cc/binary.go
@@ -69,7 +69,7 @@ type binaryDecorator struct {
|
||||
|
||||
Properties BinaryLinkerProperties
|
||||
|
||||
hostToolPath android.OptionalPath
|
||||
toolPath android.OptionalPath
|
||||
}
|
||||
|
||||
var _ linker = (*binaryDecorator)(nil)
|
||||
@@ -256,9 +256,6 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
||||
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 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
|
||||
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
|
||||
}
|
||||
|
8
cc/cc.go
8
cc/cc.go
@@ -181,6 +181,7 @@ type installer interface {
|
||||
installerProps() []interface{}
|
||||
install(ctx ModuleContext, path android.Path)
|
||||
inData() bool
|
||||
hostToolPath() android.OptionalPath
|
||||
}
|
||||
|
||||
type dependencyTag struct {
|
||||
@@ -845,6 +846,13 @@ func (c *Module) InstallInData() bool {
|
||||
return c.installer.inData()
|
||||
}
|
||||
|
||||
func (c *Module) HostToolPath() android.OptionalPath {
|
||||
if c.installer == nil {
|
||||
return android.OptionalPath{}
|
||||
}
|
||||
return c.installer.hostToolPath()
|
||||
}
|
||||
|
||||
//
|
||||
// Defaults
|
||||
//
|
||||
|
@@ -80,3 +80,7 @@ func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
|
||||
func (installer *baseInstaller) inData() bool {
|
||||
return installer.location == InstallInData
|
||||
}
|
||||
|
||||
func (installer *baseInstaller) hostToolPath() android.OptionalPath {
|
||||
return android.OptionalPath{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user