aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Blueprints18
-rw-r--r--build.ninja.in67
-rw-r--r--cc/builder.go4
-rw-r--r--cc/cc.go20
-rw-r--r--cmd/soong_build/main.go5
-rw-r--r--common/config.go (renamed from config/config.go)54
-rw-r--r--common/module.go28
-rw-r--r--common/paths.go11
-rw-r--r--genrule/genrule.go6
-rw-r--r--java/builder.go4
-rw-r--r--java/java.go12
11 files changed, 86 insertions, 143 deletions
diff --git a/Blueprints b/Blueprints
index 945d2f49..84c99131 100644
--- a/Blueprints
+++ b/Blueprints
@@ -18,7 +18,6 @@ bootstrap_go_binary {
"soong-art",
"soong-cc",
"soong-common",
- "soong-config",
"soong-env",
"soong-genrule",
"soong-java",
@@ -81,6 +80,7 @@ bootstrap_go_package {
srcs: [
"common/arch.go",
"common/checkbuild.go",
+ "common/config.go",
"common/defs.go",
"common/env.go",
"common/glob.go",
@@ -90,26 +90,12 @@ bootstrap_go_package {
}
bootstrap_go_package {
- name: "soong-config",
- pkgPath: "android/soong/config",
- deps: [
- "blueprint",
- "blueprint-bootstrap",
- "soong-common",
- ],
- srcs: [
- "config/config.go",
- ],
-}
-
-bootstrap_go_package {
name: "soong-cc",
pkgPath: "android/soong/cc",
deps: [
"blueprint",
"blueprint-pathtools",
"soong-common",
- "soong-config",
"soong-genrule",
],
srcs: [
@@ -134,7 +120,6 @@ bootstrap_go_package {
"blueprint",
"blueprint-pathtools",
"soong-common",
- "soong-config",
],
srcs: [
"genrule/genrule.go",
@@ -155,7 +140,6 @@ bootstrap_go_package {
"blueprint",
"blueprint-pathtools",
"soong-common",
- "soong-config",
],
srcs: [
"java/builder.go",
diff --git a/build.ninja.in b/build.ninja.in
index 81f6522d..2f8fe50f 100644
--- a/build.ninja.in
+++ b/build.ninja.in
@@ -53,7 +53,7 @@ rule g.bootstrap.link
# Variant:
# Type: bootstrap_go_binary
# Factory: github.com/google/blueprint/bootstrap.newGoBinaryModule
-# Defined: build/soong/Blueprints:171:1
+# Defined: build/soong/Blueprints:155:1
build .bootstrap/androidmk/obj/androidmk.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/androidmk/cmd/androidmk/android.go $
@@ -79,7 +79,7 @@ default .bootstrap/bin/androidmk
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:184:1
+# Defined: build/soong/Blueprints:168:1
build .bootstrap/androidmk-parser/pkg/android/soong/androidmk/parser.a: $
g.bootstrap.gc $
@@ -298,10 +298,9 @@ build .bootstrap/soong-art/pkg/android/soong/art.a: g.bootstrap.gc $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
.bootstrap/soong-common/pkg/android/soong/common.a $
- .bootstrap/soong-config/pkg/android/soong/config.a $
.bootstrap/soong-genrule/pkg/android/soong/genrule.a $
.bootstrap/soong-cc/pkg/android/soong/cc.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-config/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg
+ incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg
pkgPath = android/soong/art
default .bootstrap/soong-art/pkg/android/soong/art.a
@@ -310,7 +309,7 @@ default .bootstrap/soong-art/pkg/android/soong/art.a
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:105:1
+# Defined: build/soong/Blueprints:92:1
build .bootstrap/soong-cc/pkg/android/soong/cc.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/cc/builder.go $
@@ -332,9 +331,8 @@ build .bootstrap/soong-cc/pkg/android/soong/cc.a: g.bootstrap.gc $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
.bootstrap/soong-common/pkg/android/soong/common.a $
- .bootstrap/soong-config/pkg/android/soong/config.a $
.bootstrap/soong-genrule/pkg/android/soong/genrule.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-config/pkg -I .bootstrap/soong-genrule/pkg
+ incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg
pkgPath = android/soong/cc
default .bootstrap/soong-cc/pkg/android/soong/cc.a
@@ -343,11 +341,12 @@ default .bootstrap/soong-cc/pkg/android/soong/cc.a
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:72:1
+# Defined: build/soong/Blueprints:71:1
build .bootstrap/soong-common/pkg/android/soong/common.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/common/arch.go $
${g.bootstrap.srcDir}/build/soong/common/checkbuild.go $
+ ${g.bootstrap.srcDir}/build/soong/common/config.go $
${g.bootstrap.srcDir}/build/soong/common/defs.go $
${g.bootstrap.srcDir}/build/soong/common/env.go $
${g.bootstrap.srcDir}/build/soong/common/glob.go $
@@ -367,34 +366,11 @@ build .bootstrap/soong-common/pkg/android/soong/common.a: g.bootstrap.gc $
default .bootstrap/soong-common/pkg/android/soong/common.a
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Module: soong-config
-# Variant:
-# Type: bootstrap_go_package
-# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:92:1
-
-build .bootstrap/soong-config/pkg/android/soong/config.a: g.bootstrap.gc $
- ${g.bootstrap.srcDir}/build/soong/config/config.go | $
- ${g.bootstrap.gcCmd} $
- .bootstrap/blueprint-parser/pkg/github.com/google/blueprint/parser.a $
- .bootstrap/blueprint-proptools/pkg/github.com/google/blueprint/proptools.a $
- .bootstrap/blueprint/pkg/github.com/google/blueprint.a $
- .bootstrap/blueprint-deptools/pkg/github.com/google/blueprint/deptools.a $
- .bootstrap/blueprint-pathtools/pkg/github.com/google/blueprint/pathtools.a $
- .bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
- .bootstrap/soong-env/pkg/android/soong/env.a $
- .bootstrap/soong-glob/pkg/android/soong/glob.a $
- .bootstrap/soong-common/pkg/android/soong/common.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg
- pkgPath = android/soong/config
-default .bootstrap/soong-config/pkg/android/soong/config.a
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Module: soong-env
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:42:1
+# Defined: build/soong/Blueprints:41:1
build .bootstrap/soong-env/pkg/android/soong/env.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/env/env.go | ${g.bootstrap.gcCmd}
@@ -406,7 +382,7 @@ default .bootstrap/soong-env/pkg/android/soong/env.a
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:130:1
+# Defined: build/soong/Blueprints:116:1
build .bootstrap/soong-genrule/pkg/android/soong/genrule.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/genrule/genrule.go | $
@@ -419,9 +395,8 @@ build .bootstrap/soong-genrule/pkg/android/soong/genrule.a: g.bootstrap.gc $
.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
- .bootstrap/soong-common/pkg/android/soong/common.a $
- .bootstrap/soong-config/pkg/android/soong/config.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-config/pkg
+ .bootstrap/soong-common/pkg/android/soong/common.a
+ incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg
pkgPath = android/soong/genrule
default .bootstrap/soong-genrule/pkg/android/soong/genrule.a
@@ -430,7 +405,7 @@ default .bootstrap/soong-genrule/pkg/android/soong/genrule.a
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:61:1
+# Defined: build/soong/Blueprints:60:1
build .bootstrap/soong-glob/pkg/android/soong/glob.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/glob/glob.go | ${g.bootstrap.gcCmd} $
@@ -444,7 +419,7 @@ default .bootstrap/soong-glob/pkg/android/soong/glob.a
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
-# Defined: build/soong/Blueprints:151:1
+# Defined: build/soong/Blueprints:136:1
build .bootstrap/soong-java/pkg/android/soong/java.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/java/builder.go $
@@ -459,9 +434,8 @@ build .bootstrap/soong-java/pkg/android/soong/java.a: g.bootstrap.gc $
.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
- .bootstrap/soong-common/pkg/android/soong/common.a $
- .bootstrap/soong-config/pkg/android/soong/config.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-config/pkg
+ .bootstrap/soong-common/pkg/android/soong/common.a
+ incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg
pkgPath = android/soong/java
default .bootstrap/soong-java/pkg/android/soong/java.a
@@ -484,18 +458,17 @@ build .bootstrap/soong_build/obj/soong_build.a: g.bootstrap.gc $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
.bootstrap/soong-common/pkg/android/soong/common.a $
- .bootstrap/soong-config/pkg/android/soong/config.a $
.bootstrap/soong-genrule/pkg/android/soong/genrule.a $
.bootstrap/soong-cc/pkg/android/soong/cc.a $
.bootstrap/soong-art/pkg/android/soong/art.a $
.bootstrap/soong-java/pkg/android/soong/java.a
- incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-config/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg -I .bootstrap/soong-art/pkg -I .bootstrap/soong-java/pkg
+ incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg -I .bootstrap/soong-cc/pkg -I .bootstrap/soong-art/pkg -I .bootstrap/soong-java/pkg
pkgPath = soong_build
default .bootstrap/soong_build/obj/soong_build.a
build .bootstrap/soong_build/obj/a.out: g.bootstrap.link $
.bootstrap/soong_build/obj/soong_build.a | ${g.bootstrap.linkCmd}
- libDirFlags = -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-bootstrap/pkg -L .bootstrap/soong-env/pkg -L .bootstrap/soong-glob/pkg -L .bootstrap/soong-common/pkg -L .bootstrap/soong-config/pkg -L .bootstrap/soong-genrule/pkg -L .bootstrap/soong-cc/pkg -L .bootstrap/soong-art/pkg -L .bootstrap/soong-java/pkg
+ libDirFlags = -L .bootstrap/blueprint-parser/pkg -L .bootstrap/blueprint-proptools/pkg -L .bootstrap/blueprint/pkg -L .bootstrap/blueprint-deptools/pkg -L .bootstrap/blueprint-pathtools/pkg -L .bootstrap/blueprint-bootstrap/pkg -L .bootstrap/soong-env/pkg -L .bootstrap/soong-glob/pkg -L .bootstrap/soong-common/pkg -L .bootstrap/soong-genrule/pkg -L .bootstrap/soong-cc/pkg -L .bootstrap/soong-art/pkg -L .bootstrap/soong-java/pkg
default .bootstrap/soong_build/obj/a.out
build .bootstrap/bin/soong_build: g.bootstrap.cp $
@@ -507,7 +480,7 @@ default .bootstrap/bin/soong_build
# Variant:
# Type: bootstrap_go_binary
# Factory: github.com/google/blueprint/bootstrap.newGoBinaryModule
-# Defined: build/soong/Blueprints:32:1
+# Defined: build/soong/Blueprints:31:1
build .bootstrap/soong_env/obj/soong_env.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/cmd/soong_env/soong_env.go | $
@@ -529,7 +502,7 @@ default .bootstrap/bin/soong_env
# Variant:
# Type: bootstrap_go_binary
# Factory: github.com/google/blueprint/bootstrap.newGoBinaryModule
-# Defined: build/soong/Blueprints:51:1
+# Defined: build/soong/Blueprints:50:1
build .bootstrap/soong_glob/obj/soong_glob.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/cmd/soong_glob/soong_glob.go | $
@@ -554,7 +527,7 @@ default .bootstrap/bin/soong_glob
# Variant:
# Type: bootstrap_go_binary
# Factory: github.com/google/blueprint/bootstrap.newGoBinaryModule
-# Defined: build/soong/Blueprints:144:1
+# Defined: build/soong/Blueprints:129:1
build .bootstrap/soong_jar/obj/soong_jar.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/cmd/soong_jar/soong_jar.go | $
diff --git a/cc/builder.go b/cc/builder.go
index 8fc428cd..ccf04f24 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -109,8 +109,8 @@ type builderFlags struct {
func TransformSourceToObj(ctx common.AndroidModuleContext, subdir string, srcFiles []string,
flags builderFlags, deps []string) (objFiles []string) {
- srcRoot := ctx.Config().(Config).SrcDir()
- intermediatesRoot := ctx.Config().(Config).IntermediatesDir()
+ srcRoot := ctx.AConfig().SrcDir()
+ intermediatesRoot := ctx.AConfig().IntermediatesDir()
objFiles = make([]string, len(srcFiles))
objDir := common.ModuleObjDir(ctx)
diff --git a/cc/cc.go b/cc/cc.go
index b0dd7920..a5af73e1 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -30,15 +30,9 @@ import (
"android/soong/genrule"
)
-type Config interface {
- SrcDir() string
- IntermediatesDir() string
- PrebuiltOS() string
-}
-
var (
- HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", Config.PrebuiltOS)
- SrcDir = pctx.VariableConfigMethod("SrcDir", Config.SrcDir)
+ HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", common.Config.PrebuiltOS)
+ SrcDir = pctx.VariableConfigMethod("SrcDir", common.Config.SrcDir)
LibcRoot = pctx.StaticVariable("LibcRoot", "${SrcDir}/bionic/libc")
LibmRoot = pctx.StaticVariable("LibmRoot", "${SrcDir}/bionic/libm")
@@ -443,7 +437,7 @@ func (c *ccBase) collectFlags(ctx common.AndroidModuleContext, toolchain Toolcha
}
}
- flags.IncludeDirs = pathtools.PrefixPaths(c.properties.Include_dirs, ctx.Config().(Config).SrcDir())
+ flags.IncludeDirs = pathtools.PrefixPaths(c.properties.Include_dirs, ctx.AConfig().SrcDir())
localIncludeDirs := pathtools.PrefixPaths(c.properties.Local_include_dirs, common.ModuleSrcDir(ctx))
flags.IncludeDirs = append(flags.IncludeDirs, localIncludeDirs...)
@@ -769,7 +763,7 @@ func (c *ccLinked) Flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags
flags.IncludeDirs = append(flags.IncludeDirs, "${SrcDir}/bionic/libstdc++/include")
}
case "ndk_system":
- ndkSrcRoot := ctx.Config().(Config).SrcDir() + "/prebuilts/ndk/current/sources/"
+ ndkSrcRoot := ctx.AConfig().SrcDir() + "/prebuilts/ndk/current/sources/"
flags.IncludeDirs = append(flags.IncludeDirs, ndkSrcRoot+"cxx-stl/system/include")
case "ndk_libc++_shared", "ndk_libc++_static":
// TODO(danalbert): This really shouldn't be here...
@@ -1311,7 +1305,7 @@ func (c *ccTest) Flags(ctx common.AndroidModuleContext, flags CCFlags) CCFlags {
// TODO(danalbert): Make gtest export its dependencies.
flags.IncludeDirs = append(flags.IncludeDirs,
- filepath.Join(ctx.Config().(Config).SrcDir(), "external/gtest/include"))
+ filepath.Join(ctx.AConfig().SrcDir(), "external/gtest/include"))
return flags
}
@@ -1468,7 +1462,7 @@ func (c *toolchainLibrary) installModule(ctx common.AndroidModuleContext, flags
func getNdkLibDir(ctx common.AndroidModuleContext, toolchain Toolchain, version string) string {
return fmt.Sprintf("%s/prebuilts/ndk/current/platforms/android-%s/arch-%s/usr/lib",
- ctx.Config().(Config).SrcDir(), version, toolchain.Name())
+ ctx.AConfig().SrcDir(), version, toolchain.Name())
}
type ndkPrebuiltLibrary struct {
@@ -1555,7 +1549,7 @@ func getNdkStlLibDir(ctx common.AndroidModuleContext, toolchain Toolchain, stl s
}
if libDir != "" {
- ndkSrcRoot := ctx.Config().(Config).SrcDir() + "/prebuilts/ndk/current/sources"
+ ndkSrcRoot := ctx.AConfig().SrcDir() + "/prebuilts/ndk/current/sources"
return fmt.Sprintf("%s/%s/%s", ndkSrcRoot, libDir, ctx.Arch().Abi)
}
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 01740d1c..a1a4ce05 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -26,7 +26,6 @@ import (
"android/soong/art"
"android/soong/cc"
"android/soong/common"
- "android/soong/config"
"android/soong/genrule"
"android/soong/java"
)
@@ -78,7 +77,7 @@ func main() {
ctx.RegisterSingletonType("checkbuild", common.CheckbuildSingleton)
ctx.RegisterSingletonType("env", common.EnvSingleton)
- configuration, err := config.New(srcDir)
+ configuration, err := common.NewConfig(srcDir)
if err != nil {
fmt.Fprintf(os.Stderr, "%s", err)
os.Exit(1)
@@ -87,5 +86,5 @@ func main() {
// Temporary hack
//ctx.SetIgnoreUnknownModuleTypes(true)
- bootstrap.Main(ctx, configuration, config.ConfigFileName)
+ bootstrap.Main(ctx, configuration, common.ConfigFileName)
}
diff --git a/config/config.go b/common/config.go
index e324e42d..695e27d8 100644
--- a/config/config.go
+++ b/common/config.go
@@ -12,10 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package config
+package common
import (
- "android/soong/common"
"encoding/json"
"fmt"
"os"
@@ -23,7 +22,18 @@ import (
"runtime"
)
-var _ common.Config = (*Config)(nil)
+type Config interface {
+ CpPreserveSymlinksFlags() string
+ SrcDir() string
+ IntermediatesDir() string
+ Getenv(string) string
+ EnvDeps() map[string]string
+ DeviceOut() string
+ HostOut() string
+ PrebuiltOS() string
+ HostBinTool(string) (string, error)
+ HostJavaTool(string) (string, error)
+}
// The configuration file name
const ConfigFileName = "soong.config"
@@ -39,7 +49,7 @@ func NewFileConfigurableOptions() FileConfigurableOptions {
}
// A Config object represents the entire build configuration for Blue.
-type Config struct {
+type config struct {
FileConfigurableOptions
srcDir string // the path of the root source directory
@@ -47,7 +57,7 @@ type Config struct {
}
// loads configuration options from a JSON file in the cwd.
-func loadFromConfigFile(config *Config) error {
+func loadFromConfigFile(config *config) error {
// Make a proxy config
var configProxy FileConfigurableOptions
@@ -103,9 +113,9 @@ func saveToConfigFile(config FileConfigurableOptions) error {
// New creates a new Config object. The srcDir argument specifies the path to
// the root source directory. It also loads the config file, if found.
-func New(srcDir string) (*Config, error) {
+func NewConfig(srcDir string) (Config, error) {
// Make a config with default options
- config := &Config{
+ config := &config{
srcDir: srcDir,
envDeps: make(map[string]string),
}
@@ -119,21 +129,21 @@ func New(srcDir string) (*Config, error) {
return config, nil
}
-func (c *Config) SrcDir() string {
+func (c *config) SrcDir() string {
return c.srcDir
}
-func (c *Config) IntermediatesDir() string {
+func (c *config) IntermediatesDir() string {
return ".intermediates"
}
// HostGoOS returns the OS of the system that the Go toolchain is being run on.
-func (c *Config) HostGoOS() string {
+func (c *config) HostGoOS() string {
return runtime.GOOS
}
// PrebuiltOS returns the name of the host OS used in prebuilts directories
-func (c *Config) PrebuiltOS() string {
+func (c *config) PrebuiltOS() string {
switch runtime.GOOS {
case "linux":
return "linux-x86"
@@ -145,11 +155,11 @@ func (c *Config) PrebuiltOS() string {
}
// GoRoot returns the path to the root directory of the Go toolchain.
-func (c *Config) GoRoot() string {
+func (c *config) GoRoot() string {
return fmt.Sprintf("%s/prebuilts/go/%s", c.srcDir, c.PrebuiltOS())
}
-func (c *Config) CpPreserveSymlinksFlags() string {
+func (c *config) CpPreserveSymlinksFlags() string {
switch c.HostGoOS() {
case "darwin":
return "-R"
@@ -160,7 +170,7 @@ func (c *Config) CpPreserveSymlinksFlags() string {
}
}
-func (c *Config) Getenv(key string) string {
+func (c *config) Getenv(key string) string {
var val string
var exists bool
if val, exists = c.envDeps[key]; !exists {
@@ -170,42 +180,42 @@ func (c *Config) Getenv(key string) string {
return val
}
-func (c *Config) EnvDeps() map[string]string {
+func (c *config) EnvDeps() map[string]string {
return c.envDeps
}
// DeviceName returns the name of the current device target
// TODO: take an AndroidModuleContext to select the device name for multi-device builds
-func (c *Config) DeviceName() string {
+func (c *config) DeviceName() string {
return "unset"
}
// DeviceOut returns the path to out directory for device targets
-func (c *Config) DeviceOut() string {
+func (c *config) DeviceOut() string {
return filepath.Join("target/product", c.DeviceName())
}
// HostOut returns the path to out directory for host targets
-func (c *Config) HostOut() string {
+func (c *config) HostOut() string {
return filepath.Join("host", c.PrebuiltOS())
}
// HostBin returns the path to bin directory for host targets
-func (c *Config) HostBin() string {
+func (c *config) HostBin() string {
return filepath.Join(c.HostOut(), "bin")
}
// HostBinTool returns the path to a host tool in the bin directory for host targets
-func (c *Config) HostBinTool(tool string) (string, error) {
+func (c *config) HostBinTool(tool string) (string, error) {
return filepath.Join(c.HostBin(), tool), nil
}
// HostJavaDir returns the path to framework directory for host targets
-func (c *Config) HostJavaDir() string {
+func (c *config) HostJavaDir() string {
return filepath.Join(c.HostOut(), "framework")
}
// HostJavaTool returns the path to a host tool in the frameworks directory for host targets
-func (c *Config) HostJavaTool(tool string) (string, error) {
+func (c *config) HostJavaTool(tool string) (string, error) {
return filepath.Join(c.HostJavaDir(), tool), nil
}
diff --git a/common/module.go b/common/module.go
index e61d3131..d4970760 100644
--- a/common/module.go
+++ b/common/module.go
@@ -20,16 +20,6 @@ import (
"github.com/google/blueprint"
)
-type Config interface {
- CpPreserveSymlinksFlags() string
- SrcDir() string
- IntermediatesDir() string
- Getenv(string) string
- EnvDeps() map[string]string
- DeviceOut() string
- HostOut() string
-}
-
var (
DeviceSharedLibrary = "shared_library"
DeviceStaticLibrary = "static_library"
@@ -44,6 +34,7 @@ type androidBaseContext interface {
Host() bool
Device() bool
Debug() bool
+ AConfig() Config
}
type AndroidBaseContext interface {
@@ -299,7 +290,8 @@ func (a *AndroidModuleBase) DynamicDependencies(ctx blueprint.DynamicDependerMod
actx := &androidDynamicDependerContext{
DynamicDependerModuleContext: ctx,
androidBaseContextImpl: androidBaseContextImpl{
- arch: a.commonProperties.CompileArch,
+ arch: a.commonProperties.CompileArch,
+ config: ctx.Config().(Config),
},
}
@@ -314,7 +306,8 @@ func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
androidCtx := &androidModuleContext{
ModuleContext: ctx,
androidBaseContextImpl: androidBaseContextImpl{
- arch: a.commonProperties.CompileArch,
+ arch: a.commonProperties.CompileArch,
+ config: ctx.Config().(Config),
},
installDeps: a.computeInstallDeps(ctx),
installFiles: a.installFiles,
@@ -340,8 +333,9 @@ func (a *AndroidModuleBase) GenerateBuildActions(ctx blueprint.ModuleContext) {
}
type androidBaseContextImpl struct {
- arch Arch
- debug bool
+ arch Arch
+ debug bool
+ config Config
}
type androidModuleContext struct {
@@ -382,10 +376,14 @@ func (a *androidBaseContextImpl) Debug() bool {
return a.debug
}
+func (a *androidBaseContextImpl) AConfig() Config {
+ return a.config
+}
+
func (a *androidModuleContext) InstallFileName(installPath, name, srcPath string,
deps ...string) string {
- config := a.Config().(Config)
+ config := a.AConfig()
var fullInstallPath string
if a.arch.HostOrDevice.Device() {
// TODO: replace unset with a device name once we have device targeting
diff --git a/common/paths.go b/common/paths.go
index b052feff..bcd6d8c7 100644
--- a/common/paths.go
+++ b/common/paths.go
@@ -16,21 +16,18 @@ package common
import (
"path/filepath"
-
- "github.com/google/blueprint"
)
// ModuleOutDir returns the path to the module-specific output directory.
func ModuleOutDir(ctx AndroidModuleContext) string {
- config := ctx.Config().(Config)
- return filepath.Join(config.IntermediatesDir(), ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir())
+ return filepath.Join(ctx.AConfig().IntermediatesDir(),
+ ctx.ModuleDir(), ctx.ModuleName(), ctx.ModuleSubDir())
}
// ModuleSrcDir returns the path of the directory that all source file paths are
// specified relative to.
-func ModuleSrcDir(ctx blueprint.ModuleContext) string {
- config := ctx.Config().(Config)
- return filepath.Join(config.SrcDir(), ctx.ModuleDir())
+func ModuleSrcDir(ctx AndroidModuleContext) string {
+ return filepath.Join(ctx.AConfig().SrcDir(), ctx.ModuleDir())
}
// ModuleBinDir returns the path to the module- and architecture-specific binary
diff --git a/genrule/genrule.go b/genrule/genrule.go
index e2b6c7da..589758d8 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -23,16 +23,12 @@ import (
"android/soong/common"
)
-type Config interface {
- SrcDir() string
-}
-
var (
pctx = blueprint.NewPackageContext("android/soong/genrule")
)
func init() {
- pctx.VariableConfigMethod("srcDir", Config.SrcDir)
+ pctx.VariableConfigMethod("srcDir", common.Config.SrcDir)
}
type SourceFileGenerator interface {
diff --git a/java/builder.go b/java/builder.go
index f0cfeaea..4eb03c25 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -85,10 +85,10 @@ func init() {
pctx.StaticVariable("javacCmd", "javac -J-Xmx1024M $commonJdkFlags")
pctx.StaticVariable("jarCmd", filepath.Join(bootstrap.BinDir, "soong_jar"))
pctx.VariableFunc("dxCmd", func(c interface{}) (string, error) {
- return c.(Config).HostBinTool("dx")
+ return c.(common.Config).HostBinTool("dx")
})
pctx.VariableFunc("jarjarCmd", func(c interface{}) (string, error) {
- return c.(Config).HostJavaTool("jarjar.jar")
+ return c.(common.Config).HostJavaTool("jarjar.jar")
})
}
diff --git a/java/java.go b/java/java.go
index f9347218..8750dbf8 100644
--- a/java/java.go
+++ b/java/java.go
@@ -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",