bp2build for sanitizer blocklists long term fix
Bug: 286872909 Test: Unit tests Test: b build relevant targets Change-Id: I553091f76fca936006651b1ed22c8fe4d176e18f
This commit is contained in:
@@ -76,6 +76,8 @@ const (
|
||||
NonApex = "non_apex"
|
||||
|
||||
ErrorproneDisabled = "errorprone_disabled"
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
SanitizersEnabled = "sanitizers_enabled"
|
||||
)
|
||||
|
||||
func PowerSetWithoutEmptySet[T any](items []T) [][]T {
|
||||
@@ -223,6 +225,12 @@ var (
|
||||
ErrorproneDisabled: "//build/bazel/rules/java/errorprone:errorprone_globally_disabled",
|
||||
ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
|
||||
}
|
||||
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
sanitizersEnabledMap = map[string]string{
|
||||
SanitizersEnabled: "//build/bazel/rules/cc:sanitizers_enabled",
|
||||
ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
|
||||
}
|
||||
)
|
||||
|
||||
// basic configuration types
|
||||
@@ -237,6 +245,8 @@ const (
|
||||
osAndInApex
|
||||
inApex
|
||||
errorProneDisabled
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
sanitizersEnabled
|
||||
)
|
||||
|
||||
func osArchString(os string, arch string) string {
|
||||
@@ -253,6 +263,8 @@ func (ct configurationType) String() string {
|
||||
osAndInApex: "os_in_apex",
|
||||
inApex: "in_apex",
|
||||
errorProneDisabled: "errorprone_disabled",
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
sanitizersEnabled: "sanitizers_enabled",
|
||||
}[ct]
|
||||
}
|
||||
|
||||
@@ -287,6 +299,11 @@ func (ct configurationType) validateConfig(config string) {
|
||||
if _, ok := errorProneMap[config]; !ok {
|
||||
panic(fmt.Errorf("Unknown errorprone config: %s", config))
|
||||
}
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
case sanitizersEnabled:
|
||||
if _, ok := sanitizersEnabledMap[config]; !ok {
|
||||
panic(fmt.Errorf("Unknown sanitizers_enabled config: %s", config))
|
||||
}
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ct))
|
||||
}
|
||||
@@ -318,6 +335,9 @@ func (ca ConfigurationAxis) SelectKey(config string) string {
|
||||
return inApexMap[config]
|
||||
case errorProneDisabled:
|
||||
return errorProneMap[config]
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
case sanitizersEnabled:
|
||||
return sanitizersEnabledMap[config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ca.configurationType))
|
||||
}
|
||||
@@ -338,6 +358,9 @@ var (
|
||||
InApexAxis = ConfigurationAxis{configurationType: inApex}
|
||||
|
||||
ErrorProneAxis = ConfigurationAxis{configurationType: errorProneDisabled}
|
||||
|
||||
// TODO: b/294868620 - Remove when completing the bug
|
||||
SanitizersEnabledAxis = ConfigurationAxis{configurationType: sanitizersEnabled}
|
||||
)
|
||||
|
||||
// ProductVariableConfigurationAxis returns an axis for the given product variable
|
||||
|
@@ -433,7 +433,7 @@ func (la *LabelAttribute) SetSelectValue(axis ConfigurationAxis, config string,
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
la.Value = &value
|
||||
case arch, os, osArch, productVariables, osAndInApex:
|
||||
case arch, os, osArch, productVariables, osAndInApex, sanitizersEnabled:
|
||||
if la.ConfigurableValues == nil {
|
||||
la.ConfigurableValues = make(configurableLabels)
|
||||
}
|
||||
@@ -449,7 +449,7 @@ func (la *LabelAttribute) SelectValue(axis ConfigurationAxis, config string) *La
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return la.Value
|
||||
case arch, os, osArch, productVariables, osAndInApex:
|
||||
case arch, os, osArch, productVariables, osAndInApex, sanitizersEnabled:
|
||||
return la.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
@@ -519,7 +519,7 @@ func (ba *BoolAttribute) SetSelectValue(axis ConfigurationAxis, config string, v
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
ba.Value = value
|
||||
case arch, os, osArch, productVariables, osAndInApex:
|
||||
case arch, os, osArch, productVariables, osAndInApex, sanitizersEnabled:
|
||||
if ba.ConfigurableValues == nil {
|
||||
ba.ConfigurableValues = make(configurableBools)
|
||||
}
|
||||
@@ -666,7 +666,7 @@ func (ba BoolAttribute) SelectValue(axis ConfigurationAxis, config string) *bool
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return ba.Value
|
||||
case arch, os, osArch, productVariables, osAndInApex:
|
||||
case arch, os, osArch, productVariables, osAndInApex, sanitizersEnabled:
|
||||
if v, ok := ba.ConfigurableValues[axis][config]; ok {
|
||||
return &v
|
||||
} else {
|
||||
@@ -801,7 +801,7 @@ func (lla *LabelListAttribute) SetSelectValue(axis ConfigurationAxis, config str
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
lla.Value = list
|
||||
case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled:
|
||||
case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled, sanitizersEnabled:
|
||||
if lla.ConfigurableValues == nil {
|
||||
lla.ConfigurableValues = make(configurableLabelLists)
|
||||
}
|
||||
@@ -817,7 +817,7 @@ func (lla *LabelListAttribute) SelectValue(axis ConfigurationAxis, config string
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return lla.Value
|
||||
case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled:
|
||||
case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled, sanitizersEnabled:
|
||||
return lla.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
@@ -1175,7 +1175,7 @@ func (sa *StringAttribute) SetSelectValue(axis ConfigurationAxis, config string,
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
sa.Value = str
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, productVariables, sanitizersEnabled:
|
||||
if sa.ConfigurableValues == nil {
|
||||
sa.ConfigurableValues = make(configurableStrings)
|
||||
}
|
||||
@@ -1191,7 +1191,7 @@ func (sa *StringAttribute) SelectValue(axis ConfigurationAxis, config string) *s
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return sa.Value
|
||||
case arch, os, osArch, productVariables:
|
||||
case arch, os, osArch, productVariables, sanitizersEnabled:
|
||||
if v, ok := sa.ConfigurableValues[axis][config]; ok {
|
||||
return v
|
||||
} else {
|
||||
@@ -1381,7 +1381,7 @@ func (sla *StringListAttribute) SetSelectValue(axis ConfigurationAxis, config st
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
sla.Value = list
|
||||
case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled:
|
||||
case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled, sanitizersEnabled:
|
||||
if sla.ConfigurableValues == nil {
|
||||
sla.ConfigurableValues = make(configurableStringLists)
|
||||
}
|
||||
@@ -1397,7 +1397,7 @@ func (sla *StringListAttribute) SelectValue(axis ConfigurationAxis, config strin
|
||||
switch axis.configurationType {
|
||||
case noConfig:
|
||||
return sla.Value
|
||||
case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled:
|
||||
case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled, sanitizersEnabled:
|
||||
return sla.ConfigurableValues[axis][config]
|
||||
default:
|
||||
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
|
||||
|
Reference in New Issue
Block a user