Merge "Add D8 support"
This commit is contained in:
@@ -117,15 +117,23 @@ func (p AndroidPackageContext) SourcePathVariableWithEnvOverride(name, path, env
|
|||||||
// package-scoped variable's initialization.
|
// package-scoped variable's initialization.
|
||||||
func (p AndroidPackageContext) HostBinToolVariable(name, path string) blueprint.Variable {
|
func (p AndroidPackageContext) HostBinToolVariable(name, path string) blueprint.Variable {
|
||||||
return p.VariableFunc(name, func(config interface{}) (string, error) {
|
return p.VariableFunc(name, func(config interface{}) (string, error) {
|
||||||
ctx := &configErrorWrapper{p, config.(Config), []error{}}
|
po, err := p.HostBinToolPath(config, path)
|
||||||
p := PathForOutput(ctx, "host", ctx.config.PrebuiltOS(), "bin", path)
|
if err != nil {
|
||||||
if len(ctx.errors) > 0 {
|
return "", err
|
||||||
return "", ctx.errors[0]
|
|
||||||
}
|
}
|
||||||
return p.String(), nil
|
return po.String(), nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p AndroidPackageContext) HostBinToolPath(config interface{}, path string) (Path, error) {
|
||||||
|
ctx := &configErrorWrapper{p, config.(Config), []error{}}
|
||||||
|
pa := PathForOutput(ctx, "host", ctx.config.PrebuiltOS(), "bin", path)
|
||||||
|
if len(ctx.errors) > 0 {
|
||||||
|
return nil, ctx.errors[0]
|
||||||
|
}
|
||||||
|
return pa, nil
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@@ -77,7 +77,22 @@ func init() {
|
|||||||
pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
|
pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
|
||||||
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
||||||
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
|
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
|
||||||
pctx.HostBinToolVariable("DxCmd", "dx")
|
pctx.VariableFunc("DxCmd", func(config interface{}) (string, error) {
|
||||||
|
dexer := "dx"
|
||||||
|
if config.(android.Config).Getenv("USE_D8") == "true" {
|
||||||
|
dexer = "d8"
|
||||||
|
}
|
||||||
|
if config.(android.Config).UnbundledBuild() {
|
||||||
|
return "prebuilts/build-tools/common/bin/" + dexer, nil
|
||||||
|
} else {
|
||||||
|
path, err := pctx.HostBinToolPath(config, dexer)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return path.String(), nil
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar")
|
pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar")
|
||||||
pctx.HostJavaToolVariable("DesugarJar", "desugar.jar")
|
pctx.HostJavaToolVariable("DesugarJar", "desugar.jar")
|
||||||
|
|
||||||
|
@@ -43,6 +43,8 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
|
|||||||
ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
|
ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
|
||||||
ctx.Strict("JAVADOC", "${JavadocCmd}")
|
ctx.Strict("JAVADOC", "${JavadocCmd}")
|
||||||
ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
|
ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
|
||||||
|
ctx.Strict("DX", "${DxCmd}")
|
||||||
|
ctx.Strict("DX_COMMAND", "${DxCmd} -JXms16M -JXmx2048M")
|
||||||
|
|
||||||
if ctx.Config().IsEnvTrue("RUN_ERROR_PRONE") {
|
if ctx.Config().IsEnvTrue("RUN_ERROR_PRONE") {
|
||||||
ctx.Strict("TARGET_JAVAC", "${ErrorProneCmd}")
|
ctx.Strict("TARGET_JAVAC", "${ErrorProneCmd}")
|
||||||
|
Reference in New Issue
Block a user