Merge "Add CFI product config variables to platform_mappings" into main am: 00d0d7af7d
am: 110f8b4a08
am: 57073321bf
am: 2d0c4a1efa
am: 9ccedba777
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2660958 Change-Id: Iff8146b25b6ddc03b53ddb1c2b32ac1943ee9a29 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,7 +18,6 @@ package android
|
||||
// product variables necessary for soong_build's operation.
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -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
|
||||
|
Reference in New Issue
Block a user