bp2build: convert paths/module refs to Bazel label
This currently expands all globs, still need to support converting glob
syntax.
Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
diff --git a/bazel/properties.go b/bazel/properties.go
index 79956e1..5b98d15 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -35,3 +35,26 @@
// The target label for the bzl file containing the definition of the rule class.
Bzl_load_location string
}
+
+// Label is used to represent a Bazel compatible Label. Also stores the original bp text to support
+// string replacement.
+type Label struct {
+ Bp_text string
+ Label string
+}
+
+// LabelList is used to represent a list of Bazel labels.
+type LabelList struct {
+ Includes []Label
+ Excludes []Label
+}
+
+// Append appends the fields of other labelList to the corresponding fields of ll.
+func (ll *LabelList) Append(other LabelList) {
+ if len(ll.Includes) > 0 || len(other.Includes) > 0 {
+ ll.Includes = append(ll.Includes, other.Includes...)
+ }
+ if len(ll.Excludes) > 0 || len(other.Excludes) > 0 {
+ ll.Excludes = append(other.Excludes, other.Excludes...)
+ }
+}