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

@@ -31,6 +31,7 @@ import (
"encoding/json"
"fmt"
"path/filepath"
"reflect"
"strings"
"github.com/google/blueprint/proptools"
@@ -692,6 +693,22 @@ func (module *PrebuiltEtc) ConvertWithBp2build(ctx android.TopDownMutatorContext
src.SetSelectValue(axis, config, label)
}
}
for propName, productConfigProps := range android.ProductVariableProperties(ctx) {
for configProp, propVal := range productConfigProps {
if propName == "Src" {
props, ok := propVal.(*string)
if !ok {
ctx.PropertyErrorf(" Expected Property to have type string, but was %s\n", reflect.TypeOf(propVal).String())
continue
}
if props != nil {
label := android.BazelLabelForModuleSrcSingle(ctx, *props)
src.SetSelectValue(configProp.ConfigurationAxis(), configProp.SelectKey(), label)
}
}
}
}
}
var filename string