Merge "Move/dedupe some host path functions in package_ctx.go." am: 455e3a089d
am: 47a7da1485
am: 1c0a6ebb26
Change-Id: I72f384073fff467ba53a8dea9422b4296605bb26
This commit is contained in:
commit
213d6533cc
|
@ -418,6 +418,18 @@ func (c *config) HostToolPath(ctx PathContext, tool string) Path {
|
|||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool)
|
||||
}
|
||||
|
||||
func (c *config) HostJNIToolPath(ctx PathContext, path string) Path {
|
||||
ext := ".so"
|
||||
if runtime.GOOS == "darwin" {
|
||||
ext = ".dylib"
|
||||
}
|
||||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "lib64", path+ext)
|
||||
}
|
||||
|
||||
func (c *config) HostJavaToolPath(ctx PathContext, path string) Path {
|
||||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "framework", path)
|
||||
}
|
||||
|
||||
// HostSystemTool looks for non-hermetic tools from the system we're running on.
|
||||
// Generally shouldn't be used, but useful to find the XCode SDK, etc.
|
||||
func (c *config) HostSystemTool(name string) string {
|
||||
|
|
|
@ -16,7 +16,6 @@ package android
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -177,46 +176,30 @@ func (p PackageContext) SourcePathVariableWithEnvOverride(name, path, env string
|
|||
// 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
|
||||
|
|
|
@ -43,7 +43,7 @@ func init() {
|
|||
if !ctx.Config().FrameworksBaseDirExists(ctx) {
|
||||
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
2
cc/rs.go
2
cc/rs.go
|
@ -29,7 +29,7 @@ func init() {
|
|||
// Use RenderScript prebuilts for unbundled builds but not PDK builds
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, "llvm-rs-cc").String()
|
||||
return ctx.Config().HostToolPath(ctx, "llvm-rs-cc").String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ func init() {
|
|||
if ctx.Config().UnbundledBuild() {
|
||||
return "prebuilts/build-tools/common/framework/" + turbine
|
||||
} else {
|
||||
return pctx.HostJavaToolPath(ctx, turbine).String()
|
||||
return ctx.Config().HostJavaToolPath(ctx, turbine).String()
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -171,7 +171,7 @@ func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
||||
} else {
|
||||
return pctx.HostJavaToolPath(ctx, tool+".jar").String()
|
||||
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
|||
}
|
||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "lib64", tool+ext)
|
||||
} else {
|
||||
return pctx.HostJNIToolPath(ctx, tool).String()
|
||||
return ctx.Config().HostJNIToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
|
|||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
||||
} else {
|
||||
return pctx.HostBinToolPath(ctx, tool).String()
|
||||
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ func stubFlagsRule(ctx android.SingletonContext) {
|
|||
rule.MissingDeps(missingDeps)
|
||||
|
||||
rule.Command().
|
||||
Tool(pctx.HostBinToolPath(ctx, "hiddenapi")).
|
||||
Tool(ctx.Config().HostToolPath(ctx, "hiddenapi")).
|
||||
Text("list").
|
||||
FlagForEachInput("--boot-dex=", bootDexJars).
|
||||
FlagWithInputList("--public-stub-classpath=", publicStubPaths, ":").
|
||||
|
|
Loading…
Reference in New Issue