Prevent runtime module paths being used in include_dirs
Adds a new StartsWith(string) ValueMatcher along with
With[Out]Matcher(...) methods to support new restrictions that prevent
any paths into runtime module repositories from being added to the
include_dirs.
Test: m nothing
Bug: 35624006
Change-Id: Ib954998e5fc190d8a11a8c6ac5f810cad927aac3
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index ee3c94f..02b4362 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -23,6 +23,29 @@
fs map[string][]byte
expectedError string
}{
+ // include_dir rule tests
+ {
+ name: "include_dir not allowed to reference art",
+ fs: map[string][]byte{
+ "other/Blueprints": []byte(`
+ cc_library {
+ name: "libother",
+ include_dirs: ["art/libdexfile/include"],
+ }`),
+ },
+ expectedError: "all usages of 'art' have been migrated",
+ },
+ {
+ name: "include_dir can reference another location",
+ fs: map[string][]byte{
+ "other/Blueprints": []byte(`
+ cc_library {
+ name: "libother",
+ include_dirs: ["another/include"],
+ }`),
+ },
+ },
+ // Treble rule tests
{
name: "no vndk.enabled under vendor directory",
fs: map[string][]byte{
@@ -217,6 +240,7 @@
}
type mockCcLibraryProperties struct {
+ Include_dirs []string
Vendor_available *bool
Vndk struct {