Move config into common and provide helper

Using ctx.Config().(Config) everywhere is a mouthful, and it is
inefficient to do the type assertion.  Put the Config interface into
the context, and provide an AConfig() to return the Config already
converted to the right type.

Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
This commit is contained in:
Colin Cross
2015-04-07 17:11:30 -07:00
parent 8df14ac3f0
commit 1332b0035c
11 changed files with 86 additions and 143 deletions

View File

@@ -29,14 +29,6 @@ import (
"android/soong/common"
)
type Config interface {
SrcDir() string
PrebuiltOS() string
HostBinTool(string) (string, error)
HostJavaTool(string) (string, error)
Getenv(string) string
}
// TODO:
// Autogenerated files:
// AIDL
@@ -266,11 +258,11 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
dxFlags = append(dxFlags, "--no-locals")
}
if ctx.Config().(Config).Getenv("NO_OPTIMIZE_DX") != "" {
if ctx.AConfig().Getenv("NO_OPTIMIZE_DX") != "" {
dxFlags = append(dxFlags, "--no-optimize")
}
if ctx.Config().(Config).Getenv("GENERATE_DEX_DEBUG") != "" {
if ctx.AConfig().Getenv("GENERATE_DEX_DEBUG") != "" {
dxFlags = append(dxFlags,
"--debug",
"--verbose",