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
diff --git a/android/config.go b/android/config.go
index c8d7cfd..95d93c0 100644
--- a/android/config.go
+++ b/android/config.go
@@ -355,14 +355,14 @@
config.bp2buildModuleTypeConfig = map[string]bool{}
+ determineBuildOS(config)
+
return Config{config}
}
func modifyTestConfigToSupportArchMutator(testConfig Config) {
config := testConfig.config
- determineBuildOS(config)
-
config.Targets = map[OsType][]Target{
Android: []Target{
{Android, Arch{ArchType: Arm64, ArchVariant: "armv8-a", Abi: []string{"arm64-v8a"}}, NativeBridgeDisabled, "", "", false},
@@ -568,15 +568,17 @@
}
func (c *config) HostToolPath(ctx PathContext, tool string) Path {
- return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool)
+ path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
+ return path
}
-func (c *config) HostJNIToolPath(ctx PathContext, path string) Path {
+func (c *config) HostJNIToolPath(ctx PathContext, lib string) Path {
ext := ".so"
if runtime.GOOS == "darwin" {
ext = ".dylib"
}
- return PathForOutput(ctx, "host", c.PrebuiltOS(), "lib64", path+ext)
+ path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext)
+ return path
}
func (c *config) HostJavaToolPath(ctx PathContext, path string) Path {
diff --git a/android/rule_builder.go b/android/rule_builder.go
index c9a9ddd..1c6b1c0 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -833,10 +833,11 @@
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())