diff options
| author | Colin Cross <ccross@android.com> | 2015-04-10 15:43:55 -0700 |
|---|---|---|
| committer | Colin Cross <ccross@android.com> | 2015-04-10 15:50:37 -0700 |
| commit | c3c0a4962265d37a92d4df4016b3711367824364 (patch) | |
| tree | 89cc5be6e970ef9d4843d76430e31c6c49d04452 /common/config.go | |
| parent | 8cf1334116bb8a4fdc1ff1b2ba924d1598ad382f (diff) | |
| download | build_soong-c3c0a4962265d37a92d4df4016b3711367824364.tar.gz build_soong-c3c0a4962265d37a92d4df4016b3711367824364.tar.bz2 build_soong-c3c0a4962265d37a92d4df4016b3711367824364.zip | |
Remove Config interface
Replace the Config interface with a struct that wraps the real
*config object. This keeps the existing pointer behavior without
having to list all of the available config functions in the interface.
Change-Id: If55a622b5a112ca5dc7193ebd59f2931b3a8e6cd
Diffstat (limited to 'common/config.go')
| -rw-r--r-- | common/config.go | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/common/config.go b/common/config.go index 695e27d8..a6837c13 100644 --- a/common/config.go +++ b/common/config.go @@ -22,19 +22,6 @@ import ( "runtime" ) -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" @@ -48,7 +35,11 @@ func NewFileConfigurableOptions() FileConfigurableOptions { return f } -// A Config object represents the entire build configuration for Blue. +type Config struct { + *config +} + +// A config object represents the entire build configuration for Blue. type config struct { FileConfigurableOptions @@ -115,15 +106,17 @@ func saveToConfigFile(config FileConfigurableOptions) error { // the root source directory. It also loads the config file, if found. func NewConfig(srcDir string) (Config, error) { // Make a config with default options - config := &config{ - srcDir: srcDir, - envDeps: make(map[string]string), + config := Config{ + config: &config{ + srcDir: srcDir, + envDeps: make(map[string]string), + }, } // Load any configurable options from the configuration file - err := loadFromConfigFile(config) + err := loadFromConfigFile(config.config) if err != nil { - return nil, err + return Config{}, err } return config, nil |
