Expose HostToolPath on the cc module to fix genrule.tool

am: 4aa75ca244

Change-Id: I1664e5f50df8a22bf91eba1f91af0c8ca41bae79
This commit is contained in:
Dan Willemsen
2016-09-29 05:42:34 +00:00
committed by android-build-merger
3 changed files with 22 additions and 6 deletions

View File

@@ -69,7 +69,7 @@ type binaryDecorator struct {
Properties BinaryLinkerProperties Properties BinaryLinkerProperties
hostToolPath android.OptionalPath toolPath android.OptionalPath
} }
var _ linker = (*binaryDecorator)(nil) var _ linker = (*binaryDecorator)(nil)
@@ -256,9 +256,6 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix() fileName := binary.getStem(ctx) + flags.Toolchain.ExecutableSuffix()
outputFile := android.PathForModuleOut(ctx, fileName) outputFile := android.PathForModuleOut(ctx, fileName)
ret := outputFile ret := outputFile
if ctx.Os().Class == android.Host {
binary.hostToolPath = android.OptionalPathForPath(outputFile)
}
var linkerDeps android.Paths var linkerDeps android.Paths
@@ -291,6 +288,13 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
return ret return ret
} }
func (binary *binaryDecorator) HostToolPath() android.OptionalPath { func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) {
return binary.hostToolPath 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
} }

View File

@@ -181,6 +181,7 @@ type installer interface {
installerProps() []interface{} installerProps() []interface{}
install(ctx ModuleContext, path android.Path) install(ctx ModuleContext, path android.Path)
inData() bool inData() bool
hostToolPath() android.OptionalPath
} }
type dependencyTag struct { type dependencyTag struct {
@@ -845,6 +846,13 @@ func (c *Module) InstallInData() bool {
return c.installer.inData() return c.installer.inData()
} }
func (c *Module) HostToolPath() android.OptionalPath {
if c.installer == nil {
return android.OptionalPath{}
}
return c.installer.hostToolPath()
}
// //
// Defaults // Defaults
// //

View File

@@ -80,3 +80,7 @@ func (installer *baseInstaller) install(ctx ModuleContext, file android.Path) {
func (installer *baseInstaller) inData() bool { func (installer *baseInstaller) inData() bool {
return installer.location == InstallInData return installer.location == InstallInData
} }
func (installer *baseInstaller) hostToolPath() android.OptionalPath {
return android.OptionalPath{}
}