aboutsummaryrefslogtreecommitdiffstats
path: root/common/config.go
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2015-09-18 10:57:10 -0700
committerColin Cross <ccross@android.com>2015-09-18 10:59:41 -0700
commit2738597af04d3795434dea7637528d5a63e4aff3 (patch)
tree5db68a1db5607c2206d9f2898c70c5813f30a9f6 /common/config.go
parent33c4578b5f2fe9a7ba058d704c1f47690783ee63 (diff)
downloadbuild_soong-2738597af04d3795434dea7637528d5a63e4aff3.tar.gz
build_soong-2738597af04d3795434dea7637528d5a63e4aff3.tar.bz2
build_soong-2738597af04d3795434dea7637528d5a63e4aff3.zip
Fix product variables with no soong.variables
If soong.variables didn't exist, loadFromConfigFile would write default values to soong.variables, but return with the product variables set to the zero values. Replace jsonConfigurable.DefaultConfig() with SetDefaultConfig() that modifies the current object, and call it before writing the values. Change-Id: I7b7404c7a51975dc4493e25c775b3cf56ef335e3
Diffstat (limited to 'common/config.go')
-rw-r--r--common/config.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/config.go b/common/config.go
index a7675b97..1cd75d30 100644
--- a/common/config.go
+++ b/common/config.go
@@ -32,9 +32,8 @@ const productVariablesFileName = "soong.variables"
type FileConfigurableOptions struct {
}
-func (FileConfigurableOptions) DefaultConfig() jsonConfigurable {
- f := FileConfigurableOptions{}
- return f
+func (f *FileConfigurableOptions) SetDefaultConfig() {
+ *f = FileConfigurableOptions{}
}
type Config struct {
@@ -58,7 +57,7 @@ type config struct {
}
type jsonConfigurable interface {
- DefaultConfig() jsonConfigurable
+ SetDefaultConfig()
}
func loadConfig(config *config) error {
@@ -80,7 +79,8 @@ func loadFromConfigFile(configurable jsonConfigurable, filename string) error {
// a dependency tracking loop.
// Make a file-configurable-options with defaults, write it out using
// a json writer.
- err = saveToConfigFile(configurable.DefaultConfig(), filename)
+ configurable.SetDefaultConfig()
+ err = saveToConfigFile(configurable, filename)
if err != nil {
return err
}