diff options
author | Colin Cross <ccross@android.com> | 2017-11-28 17:34:01 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-11-29 05:04:30 +0000 |
commit | 0875c52de753b858b74a9ac285626536bee9cb57 (patch) | |
tree | f103285f38b0fab1b498eadc0d6ef2a42671e7a5 /java/config | |
parent | f2a56f0e0d1394f19c9c9bd31d700d3ff9b198fb (diff) | |
download | build_soong-0875c52de753b858b74a9ac285626536bee9cb57.tar.gz build_soong-0875c52de753b858b74a9ac285626536bee9cb57.tar.bz2 build_soong-0875c52de753b858b74a9ac285626536bee9cb57.zip |
Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}. The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.
SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does. This requires
updating every Singleton to use the android-specific methods.
Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
Diffstat (limited to 'java/config')
-rw-r--r-- | java/config/config.go | 18 | ||||
-rw-r--r-- | java/config/error_prone.go | 4 |
2 files changed, 12 insertions, 10 deletions
diff --git a/java/config/config.go b/java/config/config.go index 49481be3..466563f5 100644 --- a/java/config/config.go +++ b/java/config/config.go @@ -64,9 +64,9 @@ func init() { pctx.VariableConfigMethod("hostPrebuiltTag", android.Config.PrebuiltOS) - pctx.VariableFunc("JavaHome", func(config interface{}) (string, error) { + pctx.VariableFunc("JavaHome", func(config android.Config) (string, error) { // This is set up and guaranteed by soong_ui - return config.(android.Config).Getenv("ANDROID_JAVA_HOME"), nil + return config.Getenv("ANDROID_JAVA_HOME"), nil }) pctx.SourcePathVariable("JavaToolchain", "${JavaHome}/bin") @@ -85,9 +85,9 @@ func init() { pctx.HostBinToolVariable("SoongZipCmd", "soong_zip") pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips") pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip") - pctx.VariableFunc("DxCmd", func(config interface{}) (string, error) { - if config.(android.Config).IsEnvFalse("USE_D8") { - if config.(android.Config).UnbundledBuild() || config.(android.Config).IsPdkBuild() { + pctx.VariableFunc("DxCmd", func(config android.Config) (string, error) { + if config.IsEnvFalse("USE_D8") { + if config.UnbundledBuild() || config.IsPdkBuild() { return "prebuilts/build-tools/common/bin/dx", nil } else { path, err := pctx.HostBinToolPath(config, "dx") @@ -104,9 +104,9 @@ func init() { return path.String(), nil } }) - pctx.VariableFunc("TurbineJar", func(config interface{}) (string, error) { + pctx.VariableFunc("TurbineJar", func(config android.Config) (string, error) { turbine := "turbine.jar" - if config.(android.Config).UnbundledBuild() { + if config.UnbundledBuild() { return "prebuilts/build-tools/common/framework/" + turbine, nil } else { path, err := pctx.HostJavaToolPath(config, turbine) @@ -122,8 +122,8 @@ func init() { pctx.HostBinToolVariable("SoongJavacWrapper", "soong_javac_wrapper") - pctx.VariableFunc("JavacWrapper", func(config interface{}) (string, error) { - if override := config.(android.Config).Getenv("JAVAC_WRAPPER"); override != "" { + pctx.VariableFunc("JavacWrapper", func(config android.Config) (string, error) { + if override := config.Getenv("JAVAC_WRAPPER"); override != "" { return override + " ", nil } return "", nil diff --git a/java/config/error_prone.go b/java/config/error_prone.go index 31cbf2c9..862217f7 100644 --- a/java/config/error_prone.go +++ b/java/config/error_prone.go @@ -14,6 +14,8 @@ package config +import "android/soong/android" + var ( // These will be filled out by external/error_prone/soong/error_prone.go if it is available ErrorProneJavacJar string @@ -25,7 +27,7 @@ var ( // Wrapper that grabs value of val late so it can be initialized by a later module's init function func errorProneVar(name string, val *string) { - pctx.VariableFunc(name, func(config interface{}) (string, error) { + pctx.VariableFunc(name, func(config android.Config) (string, error) { return *val, nil }) } |