Make HostToolPath, HostJNIToolPath and sboxPathForToolRel use pathForInstall

Use pathForInstall instead of PathForOutput for HostToolPath,
HostJNIToolPath and sboxPathForToolRel so that they internally produce
an InstallPath that can later support being converted to Make install
path.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie16a62641d113873daeec4d1dd4261251bc0d0eb
This commit is contained in:
Colin Cross
2021-10-25 19:15:55 -07:00
parent a44551fec6
commit 790ef35d1e
3 changed files with 13 additions and 10 deletions

View File

@@ -833,10 +833,11 @@ func (c *RuleBuilderCommand) PathForOutput(path WritablePath) string {
func sboxPathForToolRel(ctx BuilderContext, path Path) string {
// Errors will be handled in RuleBuilder.Build where we have a context to report them
relOut, isRelOut, _ := maybeRelErr(PathForOutput(ctx, "host", ctx.Config().PrebuiltOS()).String(), path.String())
if isRelOut {
// The tool is in the output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
return filepath.Join(sboxToolsSubDir, "out", relOut)
toolDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "", false)
relOutSoong, isRelOutSoong, _ := maybeRelErr(toolDir.String(), path.String())
if isRelOutSoong {
// The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
return filepath.Join(sboxToolsSubDir, "out", relOutSoong)
}
// The tool is in the source directory, it will be copied to __SBOX_OUT_DIR__/tools/src
return filepath.Join(sboxToolsSubDir, "src", path.String())