diff options
Diffstat (limited to 'android/config.go')
| -rw-r--r-- | android/config.go | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/android/config.go b/android/config.go index fa439625d..30be7d60b 100644 --- a/android/config.go +++ b/android/config.go @@ -18,7 +18,6 @@ package android // product variables necessary for soong_build's operation. import ( - "bytes" "encoding/json" "fmt" "os" @@ -202,10 +201,10 @@ type VendorConfig soongconfig.SoongConfig // product configuration values are read from Kati-generated soong.variables. type config struct { // Options configurable with soong.variables - productVariables productVariables + productVariables ProductVariables // Only available on configs created by TestConfig - TestProductVariables *productVariables + TestProductVariables *ProductVariables // A specialized context object for Bazel/Soong mixed builds and migration // purposes. @@ -321,7 +320,7 @@ func loadConfig(config *config) error { // loadFromConfigFile loads and decodes configuration options from a JSON file // in the current working directory. -func loadFromConfigFile(configurable *productVariables, filename string) error { +func loadFromConfigFile(configurable *ProductVariables, filename string) error { // Try to open the file configFileReader, err := os.Open(filename) defer configFileReader.Close() @@ -373,7 +372,7 @@ func loadFromConfigFile(configurable *productVariables, filename string) error { // atomically writes the config file in case two copies of soong_build are running simultaneously // (for example, docs generation and ninja manifest generation) -func saveToConfigFile(config *productVariables, filename string) error { +func saveToConfigFile(config *ProductVariables, filename string) error { data, err := json.MarshalIndent(&config, "", " ") if err != nil { return fmt.Errorf("cannot marshal config data: %s", err.Error()) @@ -402,7 +401,7 @@ func saveToConfigFile(config *productVariables, filename string) error { return nil } -func saveToBazelConfigFile(config *productVariables, outDir string) error { +func saveToBazelConfigFile(config *ProductVariables, outDir string) error { dir := filepath.Join(outDir, bazel.SoongInjectionDirName, "product_config") err := createDirIfNonexistent(dir, os.ModePerm) if err != nil { @@ -431,32 +430,6 @@ func saveToBazelConfigFile(config *productVariables, outDir string) error { return fmt.Errorf("cannot marshal arch variant product variable data: %s", err.Error()) } - configJson, err := json.MarshalIndent(&config, "", " ") - if err != nil { - return fmt.Errorf("cannot marshal config data: %s", err.Error()) - } - // The backslashes need to be escaped because this text is going to be put - // inside a Starlark string literal. - configJson = bytes.ReplaceAll(configJson, []byte("\\"), []byte("\\\\")) - - bzl := []string{ - bazel.GeneratedBazelFileWarning, - fmt.Sprintf(`_product_vars = json.decode("""%s""")`, configJson), - fmt.Sprintf(`_product_var_constraints = %s`, nonArchVariantProductVariablesJson), - fmt.Sprintf(`_arch_variant_product_var_constraints = %s`, archVariantProductVariablesJson), - "\n", ` -product_vars = _product_vars - -# TODO(b/269577299) Remove these when everything switches over to loading them from product_variable_constants.bzl -product_var_constraints = _product_var_constraints -arch_variant_product_var_constraints = _arch_variant_product_var_constraints -`, - } - err = pathtools.WriteFileIfChanged(filepath.Join(dir, "product_variables.bzl"), - []byte(strings.Join(bzl, "\n")), 0644) - if err != nil { - return fmt.Errorf("Could not write .bzl config file %s", err) - } err = pathtools.WriteFileIfChanged(filepath.Join(dir, "product_variable_constants.bzl"), []byte(fmt.Sprintf(` product_var_constraints = %s arch_variant_product_var_constraints = %s @@ -1355,6 +1328,10 @@ func (c *config) BazelModulesForceEnabledByFlag() map[string]struct{} { return c.bazelForceEnabledModules } +func (c *config) IsVndkDeprecated() bool { + return !Bool(c.productVariables.KeepVndk) +} + func (c *deviceConfig) Arches() []Arch { var arches []Arch for _, target := range c.config.Targets[Android] { @@ -1932,6 +1909,10 @@ func (c *deviceConfig) RequiresInsecureExecmemForSwiftshader() bool { return c.config.productVariables.RequiresInsecureExecmemForSwiftshader } +func (c *deviceConfig) Release_aidl_use_unfrozen() bool { + return Bool(c.config.productVariables.Release_aidl_use_unfrozen) +} + func (c *config) SelinuxIgnoreNeverallows() bool { return c.productVariables.SelinuxIgnoreNeverallows } |