Make cc_genrule.srcs configurable.
Also disallow arch variant of genrule.out.
This is to be consistent with bazel where we are migrating to.
Bug: 254114674
Test: Manual
Change-Id: I685a2e64102b7bb68128b39931f0bc85878bc6de
diff --git a/genrule/genrule.go b/genrule/genrule.go
index d4ed363..14895c9 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -875,7 +875,7 @@
type genRuleProperties struct {
// names of the output files that will be generated
- Out []string `android:"arch_variant"`
+ Out []string
}
type bazelGenruleAttributes struct {
@@ -893,11 +893,27 @@
tools_prop.Append(tool_files_prop)
tools := bazel.MakeLabelListAttribute(tools_prop)
- srcs := bazel.MakeLabelListAttribute(android.BazelLabelForModuleSrc(ctx, m.properties.Srcs))
+ srcs := bazel.LabelListAttribute{}
+ srcs_labels := bazel.LabelList{}
+ // Only cc_genrule is arch specific
+ if ctx.ModuleType() == "cc_genrule" {
+ for axis, configToProps := range m.GetArchVariantProperties(ctx, &generatorProperties{}) {
+ for config, props := range configToProps {
+ if props, ok := props.(*generatorProperties); ok {
+ labels := android.BazelLabelForModuleSrcExcludes(ctx, props.Srcs, props.Exclude_srcs)
+ srcs_labels.Append(labels)
+ srcs.SetSelectValue(axis, config, labels)
+ }
+ }
+ }
+ } else {
+ srcs_labels = android.BazelLabelForModuleSrcExcludes(ctx, m.properties.Srcs, m.properties.Exclude_srcs)
+ srcs = bazel.MakeLabelListAttribute(srcs_labels)
+ }
var allReplacements bazel.LabelList
allReplacements.Append(tools.Value)
- allReplacements.Append(srcs.Value)
+ allReplacements.Append(bazel.FirstUniqueBazelLabelList(srcs_labels))
// Replace in and out variables with $< and $@
var cmd string