diff options
author | 2023-01-19 15:36:52 -0500 | |
---|---|---|
committer | 2023-01-25 15:14:03 -0500 | |
commit | 4e115cc90de936fd68ce162c847370df5fb5021c (patch) | |
tree | 6cad36e0b5f4640ba68a941dbc1e3c17055771e6 /android/util.go | |
parent | ba46e7662221801867534444e64928f438511a5b (diff) |
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
Diffstat (limited to 'android/util.go')
-rw-r--r-- | android/util.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/android/util.go b/android/util.go index a0f716047..234bda365 100644 --- a/android/util.go +++ b/android/util.go @@ -136,6 +136,32 @@ func InList(s string, list []string) bool { 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 { |