Merge "neverallow: Adding support for extra Trusty VM build" into main
diff --git a/android/neverallow.go b/android/neverallow.go
index e12e8b7..cf0b297 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -291,16 +291,20 @@
return []Rule{
NeverAllow().
ModuleType("dirgroup").
- WithMatcher("visibility", NotInList([]string{"//trusty/vendor/google/aosp/scripts"})).Because(reason),
+ WithMatcher("visibility", NotInList([]string{"//trusty/vendor/google/aosp/scripts", "//trusty/vendor/google/proprietary/scripts"})).Because(reason),
NeverAllow().
ModuleType("dirgroup").
- Without("visibility", "//trusty/vendor/google/aosp/scripts").Because(reason),
+ WithoutMatcher("visibility", InAllowedList([]string{"//trusty/vendor/google/aosp/scripts", "//trusty/vendor/google/proprietary/scripts"})).Because(reason),
NeverAllow().
ModuleType("genrule").
Without("name", "trusty-arm64.lk.elf.gen").
Without("name", "trusty-arm64-virt-test-debug.lk.elf.gen").
Without("name", "trusty-x86_64.lk.elf.gen").
Without("name", "trusty-x86_64-test.lk.elf.gen").
+ Without("name", "trusty-arm64.wv.lk.elf.gen").
+ Without("name", "trusty-arm64-virt-test-debug.wv.lk.elf.gen").
+ Without("name", "trusty-x86_64.wv.lk.elf.gen").
+ Without("name", "trusty-x86_64-test.wv.lk.elf.gen").
WithMatcher("dir_srcs", isSetMatcherInstance).Because(reason),
NeverAllow().
ModuleType("genrule").
@@ -308,6 +312,10 @@
Without("name", "trusty-arm64-virt-test-debug.lk.elf.gen").
Without("name", "trusty-x86_64.lk.elf.gen").
Without("name", "trusty-x86_64-test.lk.elf.gen").
+ Without("name", "trusty-arm64.wv.lk.elf.gen").
+ Without("name", "trusty-arm64-virt-test-debug.wv.lk.elf.gen").
+ Without("name", "trusty-x86_64.wv.lk.elf.gen").
+ Without("name", "trusty-x86_64-test.wv.lk.elf.gen").
With("keep_gendir", "true").Because(reason),
}
}
@@ -474,6 +482,18 @@
return ".not-in-list(" + strings.Join(m.allowed, ",") + ")"
}
+type InListMatcher struct {
+ allowed []string
+}
+
+func (m *InListMatcher) Test(value string) bool {
+ return InList(value, m.allowed)
+}
+
+func (m *InListMatcher) String() string {
+ return ".in-list(" + strings.Join(m.allowed, ",") + ")"
+}
+
type isSetMatcher struct{}
func (m *isSetMatcher) Test(value string) bool {
@@ -752,6 +772,10 @@
return ¬InListMatcher{allowed}
}
+func InAllowedList(allowed []string) ValueMatcher {
+ return &InListMatcher{allowed}
+}
+
// assorted utils
func cleanPaths(paths []string) []string {