Handle target.bionic in bp2build.
Soong supports some hand-crafted target.<type> that match multiple os or arch types to simplify configuring for similar targets. target.bionic is used to match on both android and linux_bionic OSes for cases where they should be handled the same way. Test: build/bazel/ci/bp2build.sh Change-Id: I47b6aaf3279e4d242c4fd0e12f24117eb98e0665
This commit is contained in:
@@ -91,6 +91,11 @@ var (
|
||||
conditionsDefault: ConditionsDefaultSelectKey, // The default condition of an os select map.
|
||||
}
|
||||
|
||||
platformBionicMap = map[string]string{
|
||||
"bionic": "//build/bazel/platforms/os:bionic",
|
||||
conditionsDefault: ConditionsDefaultSelectKey, // The default condition of an os select map.
|
||||
}
|
||||
|
||||
platformOsArchMap = map[string]string{
|
||||
osArchAndroidArm: "//build/bazel/platforms/os_arch:android_arm",
|
||||
osArchAndroidArm64: "//build/bazel/platforms/os_arch:android_arm64",
|
||||
@@ -117,6 +122,7 @@ const (
|
||||
arch
|
||||
os
|
||||
osArch
|
||||
bionic
|
||||
productVariables
|
||||
)
|
||||
|
||||
@@ -126,6 +132,7 @@ func (ct configurationType) String() string {
|
||||
arch: "arch",
|
||||
os: "os",
|
||||
osArch: "arch_os",
|
||||
bionic: "bionic",
|
||||
productVariables: "product_variables",
|
||||
}[ct]
|
||||
}
|
||||
@@ -148,6 +155,10 @@ func (ct configurationType) validateConfig(config string) {
|
||||
if _, ok := platformOsArchMap[config]; !ok {
|
||||
panic(fmt.Errorf("Unknown os+arch: %s", config))
|
||||
}
|
||||
case bionic:
|
||||
if _, ok := platformBionicMap[config]; !ok {
|
||||
panic(fmt.Errorf("Unknown for %s: %s", ct.String(), config))
|
||||
}
|
||||
case productVariables:
|
||||
// do nothing
|
||||
default:
|
||||
@@ -167,6 +178,8 @@ func (ct configurationType) SelectKey(config string) string {
|
||||
return platformOsMap[config]
|
||||
case osArch:
|
||||
return platformOsArchMap[config]
|
||||
case bionic:
|
||||
return platformBionicMap[config]
|
||||
case productVariables:
|
||||
if config == conditionsDefault {
|
||||
return ConditionsDefaultSelectKey
|
||||
@@ -186,6 +199,8 @@ var (
|
||||
OsConfigurationAxis = ConfigurationAxis{configurationType: os}
|
||||
// An axis for arch+os-specific configurations
|
||||
OsArchConfigurationAxis = ConfigurationAxis{configurationType: osArch}
|
||||
// An axis for bionic os-specific configurations
|
||||
BionicConfigurationAxis = ConfigurationAxis{configurationType: bionic}
|
||||
)
|
||||
|
||||
// ProductVariableConfigurationAxis returns an axis for the given product variable
|
||||
|
@@ -321,7 +321,7 @@ func (la *LabelAttribute) SetSelectValue(axis ConfigurationAxis, config string,
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
la.Value = &value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
if la.ConfigurableValues == nil {
|
||||
la.ConfigurableValues = make(configurableLabels)
|
||||
}
|
||||
@@ -337,7 +337,7 @@ func (la *LabelAttribute) SelectValue(axis ConfigurationAxis, config string) Lab
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return *la.Value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
return *la.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
@@ -394,7 +394,7 @@ func (ba *BoolAttribute) SetSelectValue(axis ConfigurationAxis, config string, v
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
ba.Value = value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
if ba.ConfigurableValues == nil {
|
||||
ba.ConfigurableValues = make(configurableBools)
|
||||
}
|
||||
@@ -410,7 +410,7 @@ func (ba BoolAttribute) SelectValue(axis ConfigurationAxis, config string) *bool
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return ba.Value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
if v, ok := ba.ConfigurableValues[axis][config]; ok {
|
||||
return &v
|
||||
} else {
|
||||
@@ -509,7 +509,7 @@ func (lla *LabelListAttribute) SetSelectValue(axis ConfigurationAxis, config str
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
lla.Value = list
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
if lla.ConfigurableValues == nil {
|
||||
lla.ConfigurableValues = make(configurableLabelLists)
|
||||
}
|
||||
@@ -525,7 +525,7 @@ func (lla *LabelListAttribute) SelectValue(axis ConfigurationAxis, config string
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return lla.Value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
return lla.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
@@ -682,7 +682,7 @@ func (sla *StringListAttribute) SetSelectValue(axis ConfigurationAxis, config st
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
sla.Value = list
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
if sla.ConfigurableValues == nil {
|
||||
sla.ConfigurableValues = make(configurableStringLists)
|
||||
}
|
||||
@@ -698,7 +698,7 @@ func (sla *StringListAttribute) SelectValue(axis ConfigurationAxis, config strin
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return sla.Value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, bionic, productVariables:
|
||||
return sla.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
|
Reference in New Issue
Block a user