product_variables srcs in prebuilt_etc

bp2build conversion handles product_variable srcs

bug: 228353067
Test: prebuilt_etc_conversion_test.go
Change-Id: I82d3a384ee14d4e981d502dd9eb824c87d5ae2c7
This commit is contained in:
Alix
2022-06-09 18:52:05 +00:00
parent 94e2603ab7
commit bbfd538326
6 changed files with 144 additions and 20 deletions

View File

@@ -309,7 +309,19 @@ func (la *LabelAttribute) Collapse() error {
_, containsProductVariables := axisTypes[productVariables]
if containsProductVariables {
if containsOs || containsArch || containsOsArch {
return fmt.Errorf("label attribute could not be collapsed as it has two or more unrelated axes")
if containsArch {
allProductVariablesAreArchVariant := true
for k := range la.ConfigurableValues {
if k.configurationType == productVariables && k.outerAxisType != arch {
allProductVariablesAreArchVariant = false
}
}
if !allProductVariablesAreArchVariant {
return fmt.Errorf("label attribute could not be collapsed as it has two or more unrelated axes")
}
} else {
return fmt.Errorf("label attribute could not be collapsed as it has two or more unrelated axes")
}
}
}
if (containsOs && containsArch) || (containsOsArch && (containsOs || containsArch)) {