Merge "Move/dedupe some host path functions in package_ctx.go." am: 455e3a089d
am: 47a7da1485
Change-Id: Ie07ad1f5af213958c1692a750d5fb9230443d23a
This commit is contained in:
commit
1c0a6ebb26
|
@ -418,6 +418,18 @@ func (c *config) HostToolPath(ctx PathContext, tool string) Path {
|
||||||
return PathForOutput(ctx, "host", c.PrebuiltOS(), "bin", tool)
|
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.
|
// 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.
|
// Generally shouldn't be used, but useful to find the XCode SDK, etc.
|
||||||
func (c *config) HostSystemTool(name string) string {
|
func (c *config) HostSystemTool(name string) string {
|
||||||
|
|
|
@ -16,7 +16,6 @@ package android
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/blueprint"
|
"github.com/google/blueprint"
|
||||||
|
@ -177,46 +176,30 @@ func (p PackageContext) SourcePathVariableWithEnvOverride(name, path, env string
|
||||||
// package-scoped variable's initialization.
|
// package-scoped variable's initialization.
|
||||||
func (p PackageContext) HostBinToolVariable(name, path string) blueprint.Variable {
|
func (p PackageContext) HostBinToolVariable(name, path string) blueprint.Variable {
|
||||||
return p.VariableFunc(name, func(ctx PackageVarContext) string {
|
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
|
// 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
|
// 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's initialization - either from the init() function or as part of a
|
||||||
// package-scoped variable's initialization.
|
// package-scoped variable's initialization.
|
||||||
func (p PackageContext) HostJNIToolVariable(name, path string) blueprint.Variable {
|
func (p PackageContext) HostJNIToolVariable(name, path string) blueprint.Variable {
|
||||||
return p.VariableFunc(name, func(ctx PackageVarContext) string {
|
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
|
// 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
|
// 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
|
// during a Go package's initialization - either from the init() function or as
|
||||||
// part of a package-scoped variable's initialization.
|
// part of a package-scoped variable's initialization.
|
||||||
func (p PackageContext) HostJavaToolVariable(name, path string) blueprint.Variable {
|
func (p PackageContext) HostJavaToolVariable(name, path string) blueprint.Variable {
|
||||||
return p.VariableFunc(name, func(ctx PackageVarContext) string {
|
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
|
// IntermediatesPathVariable returns a Variable whose value is the intermediate
|
||||||
// directory appended with the supplied path. It may only be called during a Go
|
// 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
|
// package's initialization - either from the init() function or as part of a
|
||||||
|
|
|
@ -43,7 +43,7 @@ func init() {
|
||||||
if !ctx.Config().FrameworksBaseDirExists(ctx) {
|
if !ctx.Config().FrameworksBaseDirExists(ctx) {
|
||||||
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
return filepath.Join(prebuiltDir, runtime.GOOS, "bin", tool)
|
||||||
} else {
|
} 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
|
// Use RenderScript prebuilts for unbundled builds but not PDK builds
|
||||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
|
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostBinToolPath(ctx, "llvm-rs-cc").String()
|
return ctx.Config().HostToolPath(ctx, "llvm-rs-cc").String()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ func init() {
|
||||||
if ctx.Config().UnbundledBuild() {
|
if ctx.Config().UnbundledBuild() {
|
||||||
return "prebuilts/build-tools/common/framework/" + turbine
|
return "prebuilts/build-tools/common/framework/" + turbine
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostJavaToolPath(ctx, turbine).String()
|
return ctx.Config().HostJavaToolPath(ctx, turbine).String()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostBinToolPath(ctx, tool).String()
|
return ctx.Config().HostToolPath(ctx, tool).String()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||||
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostJavaToolPath(ctx, tool+".jar").String()
|
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
|
||||||
}
|
}
|
||||||
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "lib64", tool+ext)
|
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "lib64", tool+ext)
|
||||||
} else {
|
} else {
|
||||||
return pctx.HostJNIToolPath(ctx, tool).String()
|
return ctx.Config().HostJNIToolPath(ctx, tool).String()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
|
||||||
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
|
||||||
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
|
||||||
} else {
|
} 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.MissingDeps(missingDeps)
|
||||||
|
|
||||||
rule.Command().
|
rule.Command().
|
||||||
Tool(pctx.HostBinToolPath(ctx, "hiddenapi")).
|
Tool(ctx.Config().HostToolPath(ctx, "hiddenapi")).
|
||||||
Text("list").
|
Text("list").
|
||||||
FlagForEachInput("--boot-dex=", bootDexJars).
|
FlagForEachInput("--boot-dex=", bootDexJars).
|
||||||
FlagWithInputList("--public-stub-classpath=", publicStubPaths, ":").
|
FlagWithInputList("--public-stub-classpath=", publicStubPaths, ":").
|
||||||
|
|
Loading…
Reference in New Issue