Loading android/mutator.go +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ var postDeps = []RegisterMutatorFunc{ registerPathDepsMutator, RegisterPrebuiltsPostDepsMutators, RegisterVisibilityRuleEnforcer, registerNeverallowMutator, RegisterNeverallowMutator, RegisterOverridePostDepsMutators, } Loading android/neverallow.go +8 −8 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ import ( // counts as a match // - it has none of the "Without" properties matched (same rules as above) func registerNeverallowMutator(ctx RegisterMutatorsContext) { func RegisterNeverallowMutator(ctx RegisterMutatorsContext) { ctx.BottomUp("neverallow", neverallowMutator).Parallel() } Loading Loading @@ -215,7 +215,7 @@ func neverallowMutator(ctx BottomUpMutatorContext) { } type ValueMatcher interface { test(string) bool Test(string) bool String() string } Loading @@ -223,7 +223,7 @@ type equalMatcher struct { expected string } func (m *equalMatcher) test(value string) bool { func (m *equalMatcher) Test(value string) bool { return m.expected == value } Loading @@ -234,7 +234,7 @@ func (m *equalMatcher) String() string { type anyMatcher struct { } func (m *anyMatcher) test(value string) bool { func (m *anyMatcher) Test(value string) bool { return true } Loading @@ -248,7 +248,7 @@ type startsWithMatcher struct { prefix string } func (m *startsWithMatcher) test(value string) bool { func (m *startsWithMatcher) Test(value string) bool { return strings.HasPrefix(value, m.prefix) } Loading @@ -260,7 +260,7 @@ type regexMatcher struct { re *regexp.Regexp } func (m *regexMatcher) test(value string) bool { func (m *regexMatcher) Test(value string) bool { return m.re.MatchString(value) } Loading Loading @@ -529,7 +529,7 @@ func hasProperty(properties []interface{}, prop ruleProperty) bool { } check := func(value string) bool { return prop.matcher.test(value) return prop.matcher.Test(value) } if matchValue(propertiesValue, check) { Loading Loading @@ -586,6 +586,6 @@ func neverallowRules(config Config) []Rule { // Overrides the default neverallow rules for the supplied config. // // For testing only. func setTestNeverallowRules(config Config, testRules []Rule) { func SetTestNeverallowRules(config Config, testRules []Rule) { config.Once(neverallowRulesKey, func() interface{} { return testRules }) } android/neverallow_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ func TestNeverallow(t *testing.T) { t.Run(test.name, func(t *testing.T) { // If the test has its own rules then use them instead of the default ones. if test.rules != nil { setTestNeverallowRules(config, test.rules) SetTestNeverallowRules(config, test.rules) } _, errs := testNeverallow(config) CheckErrorsAgainstExpectations(t, errs, test.expectedErrors) Loading @@ -283,7 +283,7 @@ func testNeverallow(config Config) (*TestContext, []error) { ctx.RegisterModuleType("java_library", newMockJavaLibraryModule) ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule) ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule) ctx.PostDepsMutators(registerNeverallowMutator) ctx.PostDepsMutators(RegisterNeverallowMutator) ctx.Register(config) _, errs := ctx.ParseBlueprintsFiles("Android.bp") Loading Loading
android/mutator.go +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ var postDeps = []RegisterMutatorFunc{ registerPathDepsMutator, RegisterPrebuiltsPostDepsMutators, RegisterVisibilityRuleEnforcer, registerNeverallowMutator, RegisterNeverallowMutator, RegisterOverridePostDepsMutators, } Loading
android/neverallow.go +8 −8 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ import ( // counts as a match // - it has none of the "Without" properties matched (same rules as above) func registerNeverallowMutator(ctx RegisterMutatorsContext) { func RegisterNeverallowMutator(ctx RegisterMutatorsContext) { ctx.BottomUp("neverallow", neverallowMutator).Parallel() } Loading Loading @@ -215,7 +215,7 @@ func neverallowMutator(ctx BottomUpMutatorContext) { } type ValueMatcher interface { test(string) bool Test(string) bool String() string } Loading @@ -223,7 +223,7 @@ type equalMatcher struct { expected string } func (m *equalMatcher) test(value string) bool { func (m *equalMatcher) Test(value string) bool { return m.expected == value } Loading @@ -234,7 +234,7 @@ func (m *equalMatcher) String() string { type anyMatcher struct { } func (m *anyMatcher) test(value string) bool { func (m *anyMatcher) Test(value string) bool { return true } Loading @@ -248,7 +248,7 @@ type startsWithMatcher struct { prefix string } func (m *startsWithMatcher) test(value string) bool { func (m *startsWithMatcher) Test(value string) bool { return strings.HasPrefix(value, m.prefix) } Loading @@ -260,7 +260,7 @@ type regexMatcher struct { re *regexp.Regexp } func (m *regexMatcher) test(value string) bool { func (m *regexMatcher) Test(value string) bool { return m.re.MatchString(value) } Loading Loading @@ -529,7 +529,7 @@ func hasProperty(properties []interface{}, prop ruleProperty) bool { } check := func(value string) bool { return prop.matcher.test(value) return prop.matcher.Test(value) } if matchValue(propertiesValue, check) { Loading Loading @@ -586,6 +586,6 @@ func neverallowRules(config Config) []Rule { // Overrides the default neverallow rules for the supplied config. // // For testing only. func setTestNeverallowRules(config Config, testRules []Rule) { func SetTestNeverallowRules(config Config, testRules []Rule) { config.Once(neverallowRulesKey, func() interface{} { return testRules }) }
android/neverallow_test.go +2 −2 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ func TestNeverallow(t *testing.T) { t.Run(test.name, func(t *testing.T) { // If the test has its own rules then use them instead of the default ones. if test.rules != nil { setTestNeverallowRules(config, test.rules) SetTestNeverallowRules(config, test.rules) } _, errs := testNeverallow(config) CheckErrorsAgainstExpectations(t, errs, test.expectedErrors) Loading @@ -283,7 +283,7 @@ func testNeverallow(config Config) (*TestContext, []error) { ctx.RegisterModuleType("java_library", newMockJavaLibraryModule) ctx.RegisterModuleType("java_library_host", newMockJavaLibraryModule) ctx.RegisterModuleType("java_device_for_host", newMockJavaLibraryModule) ctx.PostDepsMutators(registerNeverallowMutator) ctx.PostDepsMutators(RegisterNeverallowMutator) ctx.Register(config) _, errs := ctx.ParseBlueprintsFiles("Android.bp") Loading