Merge "HostToolPath should return install path"

This commit is contained in:
Treehugger Robot 2020-08-12 02:45:40 +00:00 committed by Gerrit Code Review
commit 65c74d9f89
2 changed files with 7 additions and 2 deletions

View file

@ -36,6 +36,11 @@ func TestPreferDynamicBinary(t *testing.T) {
fizzBuzz := ctx.ModuleForTests("fizz-buzz", "linux_glibc_x86_64").Output("fizz-buzz") 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") 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. // Do not compile binary modules with the --test flag.
flags := fizzBuzzDynamic.Args["rustcFlags"] flags := fizzBuzzDynamic.Args["rustcFlags"]
if strings.Contains(flags, "--test") { if strings.Contains(flags, "--test") {

View file

@ -1057,8 +1057,8 @@ func (mod *Module) HostToolPath() android.OptionalPath {
if !mod.Host() { if !mod.Host() {
return android.OptionalPath{} return android.OptionalPath{}
} }
if _, ok := mod.compiler.(*binaryDecorator); ok { if binary, ok := mod.compiler.(*binaryDecorator); ok {
return mod.outputFile return android.OptionalPathForPath(binary.baseCompiler.path)
} }
return android.OptionalPath{} return android.OptionalPath{}
} }