Revert "Revert "Prevent runtime module paths being used in include_dirs""

This reverts commit ff3d72f0bf.

Repplies original change now that issue causing build breakage has been
resolved.

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: I4c802ef25ef56f0f9b0b5e9d75531ea6f7475714
This commit is contained in:
Paul Duffin
2019-07-22 12:13:55 +01:00
parent 581656c377
commit c811170ab6
2 changed files with 91 additions and 2 deletions

View File

@@ -23,6 +23,29 @@ var neverallowTests = []struct {
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{
@@ -213,6 +236,7 @@ func testNeverallow(t *testing.T, config Config, fs map[string][]byte) (*TestCon
}
type mockCcLibraryProperties struct {
Include_dirs []string
Vendor_available *bool
Vndk struct {