Merge "Export ndk/aml arches to Bazel" am: 4d87828d15
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2300579 Change-Id: Ic24ac608ebe110ef7b6d1a6df31d85014c7b8d27 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,6 +16,7 @@ package android
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding"
|
"encoding"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"runtime"
|
"runtime"
|
||||||
@@ -1681,10 +1682,10 @@ func hasArmAndroidArch(targets []Target) bool {
|
|||||||
|
|
||||||
// archConfig describes a built-in configuration.
|
// archConfig describes a built-in configuration.
|
||||||
type archConfig struct {
|
type archConfig struct {
|
||||||
arch string
|
Arch string `json:"arch"`
|
||||||
archVariant string
|
ArchVariant string `json:"arch_variant"`
|
||||||
cpuVariant string
|
CpuVariant string `json:"cpu_variant"`
|
||||||
abi []string
|
Abi []string `json:"abis"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// getNdkAbisConfig returns the list of archConfigs that are used for building
|
// getNdkAbisConfig returns the list of archConfigs that are used for building
|
||||||
@@ -1713,8 +1714,8 @@ func decodeAndroidArchSettings(archConfigs []archConfig) ([]Target, error) {
|
|||||||
var ret []Target
|
var ret []Target
|
||||||
|
|
||||||
for _, config := range archConfigs {
|
for _, config := range archConfigs {
|
||||||
arch, err := decodeArch(Android, config.arch, &config.archVariant,
|
arch, err := decodeArch(Android, config.Arch, &config.ArchVariant,
|
||||||
&config.cpuVariant, config.abi)
|
&config.CpuVariant, config.Abi)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -2284,6 +2285,14 @@ func printArchTypeNestedStarlarkDict(dict map[ArchType]map[string][]string) stri
|
|||||||
return starlark_fmt.PrintDict(valDict, 0)
|
return starlark_fmt.PrintDict(valDict, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func printArchConfigList(arches []archConfig) string {
|
||||||
|
jsonOut, err := json.MarshalIndent(arches, "", starlark_fmt.Indention(1))
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("Error converting arch configs %#v to json: %q", arches, err))
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("json.decode('''%s''')", string(jsonOut))
|
||||||
|
}
|
||||||
|
|
||||||
func StarlarkArchConfigurations() string {
|
func StarlarkArchConfigurations() string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
_arch_to_variants = %s
|
_arch_to_variants = %s
|
||||||
@@ -2294,13 +2303,21 @@ _arch_to_features = %s
|
|||||||
|
|
||||||
_android_arch_feature_for_arch_variant = %s
|
_android_arch_feature_for_arch_variant = %s
|
||||||
|
|
||||||
|
_aml_arches = %s
|
||||||
|
|
||||||
|
_ndk_arches = %s
|
||||||
|
|
||||||
arch_to_variants = _arch_to_variants
|
arch_to_variants = _arch_to_variants
|
||||||
arch_to_cpu_variants = _arch_to_cpu_variants
|
arch_to_cpu_variants = _arch_to_cpu_variants
|
||||||
arch_to_features = _arch_to_features
|
arch_to_features = _arch_to_features
|
||||||
android_arch_feature_for_arch_variants = _android_arch_feature_for_arch_variant
|
android_arch_feature_for_arch_variants = _android_arch_feature_for_arch_variant
|
||||||
|
aml_arches = _aml_arches
|
||||||
|
ndk_arches = _ndk_arches
|
||||||
`, printArchTypeStarlarkDict(archVariants),
|
`, printArchTypeStarlarkDict(archVariants),
|
||||||
printArchTypeStarlarkDict(cpuVariants),
|
printArchTypeStarlarkDict(cpuVariants),
|
||||||
printArchTypeStarlarkDict(archFeatures),
|
printArchTypeStarlarkDict(archFeatures),
|
||||||
printArchTypeNestedStarlarkDict(androidArchFeatureMap),
|
printArchTypeNestedStarlarkDict(androidArchFeatureMap),
|
||||||
|
printArchConfigList(getAmlAbisConfig()),
|
||||||
|
printArchConfigList(getNdkAbisConfig()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user