add androidmk cc-related variables to androidmk
The adbd_test androidmk definition is missing some cc-related variables
for cc_test in mixed builds. These variables should be populated from
information from Bazel.
Bug: 265758350
Change-Id: I59d017e2eb2f139188ba3383c457cc0055372b61
diff --git a/android/util.go b/android/util.go
index a0f7160..234bda3 100644
--- a/android/util.go
+++ b/android/util.go
@@ -136,6 +136,32 @@
return IndexList(s, list) != -1
}
+func setFromList[T comparable](l []T) map[T]bool {
+ m := make(map[T]bool, len(l))
+ for _, t := range l {
+ m[t] = true
+ }
+ return m
+}
+
+// ListDifference checks if the two lists contain the same elements
+func ListDifference[T comparable](l1, l2 []T) []T {
+ diff := []T{}
+ m1 := setFromList(l1)
+ m2 := setFromList(l2)
+ for _, t := range l1 {
+ if _, ok := m2[t]; !ok {
+ diff = append(diff, t)
+ }
+ }
+ for _, t := range l2 {
+ if _, ok := m1[t]; !ok {
+ diff = append(diff, t)
+ }
+ }
+ return diff
+}
+
// Returns true if the given string s is prefixed with any string in the given prefix list.
func HasAnyPrefix(s string, prefixList []string) bool {
for _, prefix := range prefixList {