From 9a36418089efe805fcb4d3ff2ddedf8dff02a264 Mon Sep 17 00:00:00 2001 From: Nan Zhang Date: Wed, 25 Oct 2017 11:11:37 -0700 Subject: [PATCH] Use prebuilt turbine jar for unbundled javac builds. Test: m -j Change-Id: If2ab85f8591fe7ab275a1d4fefdd80d871f2c36d --- android/package_ctx.go | 9 +++++++++ java/config/config.go | 13 ++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/android/package_ctx.go b/android/package_ctx.go index f781dd44f..8e37a8322 100644 --- a/android/package_ctx.go +++ b/android/package_ctx.go @@ -149,6 +149,15 @@ func (p AndroidPackageContext) HostJavaToolVariable(name, path string) blueprint }) } +func (p AndroidPackageContext) HostJavaToolPath(config interface{}, path string) (Path, error) { + ctx := &configErrorWrapper{p, config.(Config), []error{}} + pa := PathForOutput(ctx, "host", ctx.config.PrebuiltOS(), "framework", path) + if len(ctx.errors) > 0 { + return nil, ctx.errors[0] + } + return pa, nil +} + // 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 diff --git a/java/config/config.go b/java/config/config.go index 94dfa19f1..5eb44e829 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -93,10 +93,21 @@ func init() { return path.String(), nil } }) + pctx.VariableFunc("TurbineJar", func(config interface{}) (string, error) { + turbine := "turbine.jar" + if config.(android.Config).UnbundledBuild() { + return "prebuilts/build-tools/common/framework/" + turbine, nil + } else { + path, err := pctx.HostJavaToolPath(config, turbine) + if err != nil { + return "", err + } + return path.String(), nil + } + }) pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar") pctx.HostJavaToolVariable("DesugarJar", "desugar.jar") - pctx.HostJavaToolVariable("TurbineJar", "turbine.jar") pctx.HostBinToolVariable("SoongJavacWrapper", "soong_javac_wrapper")