bp2build: arch-configurable selects for label list attrs.
This CL adds the configurable LabelListAttribute support to bp2build.
Test: go test
Change-Id: I2ef9e385d9cf1b1845988128eca1d8cda1ecb5e8
diff --git a/android/filegroup.go b/android/filegroup.go
index abbb4d4..2f13ab8 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -30,7 +30,7 @@
// https://docs.bazel.build/versions/master/be/general.html#filegroup
type bazelFilegroupAttributes struct {
- Srcs bazel.LabelList
+ Srcs bazel.LabelListAttribute
}
type bazelFilegroup struct {
@@ -57,8 +57,10 @@
return
}
+ srcs := bazel.MakeLabelListAttribute(
+ BazelLabelForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs))
attrs := &bazelFilegroupAttributes{
- Srcs: BazelLabelForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs),
+ Srcs: srcs,
}
props := bazel.BazelTargetModuleProperties{Rule_class: "filegroup"}
diff --git a/android/paths.go b/android/paths.go
index b457372..ef7e1df 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -477,6 +477,9 @@
// already be resolved by either deps mutator or path deps mutator.
func getOtherModuleLabel(ctx BazelConversionPathContext, dep, tag string) bazel.Label {
m, _ := ctx.GetDirectDep(dep)
+ if m == nil {
+ panic(fmt.Errorf("cannot get direct dep %s of %s", dep, ctx.Module().Name()))
+ }
otherLabel := bazelModuleLabel(ctx, m, tag)
label := bazelModuleLabel(ctx, ctx.Module(), "")
if samePackage(label, otherLabel) {