Move/dedupe some host path functions in package_ctx.go.
These functions don't need a PackageContext object.
Test: m
Bug: 145934348
Change-Id: Ia1da2c76cbad292f9ca79617199b2b5b6b265568
diff --git a/android/package_ctx.go b/android/package_ctx.go
index cf8face..d3527fa 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -16,7 +16,6 @@
import (
"fmt"
- "runtime"
"strings"
"github.com/google/blueprint"
@@ -177,46 +176,30 @@
// package-scoped variable's initialization.
func (p PackageContext) HostBinToolVariable(name, path string) blueprint.Variable {
return p.VariableFunc(name, func(ctx PackageVarContext) string {
- return p.HostBinToolPath(ctx, path).String()
+ return ctx.Config().HostToolPath(ctx, path).String()
})
}
-func (p PackageContext) HostBinToolPath(ctx PackageVarContext, path string) Path {
- return PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "bin", path)
-}
-
// HostJNIToolVariable returns a Variable whose value is the path to a host tool
// in the lib directory for host targets. It may only be called during a Go
// package's initialization - either from the init() function or as part of a
// package-scoped variable's initialization.
func (p PackageContext) HostJNIToolVariable(name, path string) blueprint.Variable {
return p.VariableFunc(name, func(ctx PackageVarContext) string {
- return p.HostJNIToolPath(ctx, path).String()
+ return ctx.Config().HostJNIToolPath(ctx, path).String()
})
}
-func (p PackageContext) HostJNIToolPath(ctx PackageVarContext, path string) Path {
- ext := ".so"
- if runtime.GOOS == "darwin" {
- ext = ".dylib"
- }
- return PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "lib64", path+ext)
-}
-
// HostJavaToolVariable returns a Variable whose value is the path to a host
// tool in the frameworks directory for host targets. It may only be called
// during a Go package's initialization - either from the init() function or as
// part of a package-scoped variable's initialization.
func (p PackageContext) HostJavaToolVariable(name, path string) blueprint.Variable {
return p.VariableFunc(name, func(ctx PackageVarContext) string {
- return p.HostJavaToolPath(ctx, path).String()
+ return ctx.Config().HostJavaToolPath(ctx, path).String()
})
}
-func (p PackageContext) HostJavaToolPath(ctx PackageVarContext, path string) Path {
- return PathForOutput(ctx, "host", ctx.Config().PrebuiltOS(), "framework", path)
-}
-
// IntermediatesPathVariable returns a Variable whose value is the intermediate
// directory appended with the supplied path. It may only be called during a Go
// package's initialization - either from the init() function or as part of a