Loading java/lint.go +3 −2 Original line number Diff line number Diff line Loading @@ -391,8 +391,9 @@ func (l *linter) lint(ctx android.ModuleContext) { rule.Command().Text("rm -f").Output(html).Output(text).Output(xml) var apiVersionsName, apiVersionsPrebuilt string if l.compileSdkKind == android.SdkModule { // When compiling an SDK module we use the filtered database because otherwise lint's if l.compileSdkKind == android.SdkModule || l.compileSdkKind == android.SdkSystemServer { // When compiling an SDK module (or system server) we use the filtered // database because otherwise lint's // NewApi check produces too many false positives; This database excludes information // about classes created in mainline modules hence removing those false positives. apiVersionsName = "api_versions_public_filtered.xml" Loading java/lint_test.go +17 −11 Original line number Diff line number Diff line Loading @@ -261,6 +261,9 @@ func TestJavaLintDatabaseSelectionFull(t *testing.T) { } func TestJavaLintDatabaseSelectionPublicFiltered(t *testing.T) { testCases := []string{ "module_current", "system_server_current", } bp := ` java_library { name: "foo", Loading @@ -274,17 +277,20 @@ func TestJavaLintDatabaseSelectionPublicFiltered(t *testing.T) { }, } ` for _, testCase := range testCases { thisBp := strings.Replace(bp, "XXX", testCase, 1) result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules). RunTestWithBp(t, bp) RunTestWithBp(t, thisBp) foo := result.ModuleForTests("foo", "android_common") sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto")) if !strings.Contains(*sboxProto.Commands[0].Command, "/api_versions_public_filtered.xml") { t.Error("did not use public-filtered lint api database", *sboxProto.Commands[0].Command) t.Error("did not use public-filtered lint api database for case", testCase) } if strings.Contains(*sboxProto.Commands[0].Command, "/api_versions.xml") { t.Error("used full api database") t.Error("used full api database for case", testCase) } } } Loading
java/lint.go +3 −2 Original line number Diff line number Diff line Loading @@ -391,8 +391,9 @@ func (l *linter) lint(ctx android.ModuleContext) { rule.Command().Text("rm -f").Output(html).Output(text).Output(xml) var apiVersionsName, apiVersionsPrebuilt string if l.compileSdkKind == android.SdkModule { // When compiling an SDK module we use the filtered database because otherwise lint's if l.compileSdkKind == android.SdkModule || l.compileSdkKind == android.SdkSystemServer { // When compiling an SDK module (or system server) we use the filtered // database because otherwise lint's // NewApi check produces too many false positives; This database excludes information // about classes created in mainline modules hence removing those false positives. apiVersionsName = "api_versions_public_filtered.xml" Loading
java/lint_test.go +17 −11 Original line number Diff line number Diff line Loading @@ -261,6 +261,9 @@ func TestJavaLintDatabaseSelectionFull(t *testing.T) { } func TestJavaLintDatabaseSelectionPublicFiltered(t *testing.T) { testCases := []string{ "module_current", "system_server_current", } bp := ` java_library { name: "foo", Loading @@ -274,17 +277,20 @@ func TestJavaLintDatabaseSelectionPublicFiltered(t *testing.T) { }, } ` for _, testCase := range testCases { thisBp := strings.Replace(bp, "XXX", testCase, 1) result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules). RunTestWithBp(t, bp) RunTestWithBp(t, thisBp) foo := result.ModuleForTests("foo", "android_common") sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.Output("lint.sbox.textproto")) if !strings.Contains(*sboxProto.Commands[0].Command, "/api_versions_public_filtered.xml") { t.Error("did not use public-filtered lint api database", *sboxProto.Commands[0].Command) t.Error("did not use public-filtered lint api database for case", testCase) } if strings.Contains(*sboxProto.Commands[0].Command, "/api_versions.xml") { t.Error("used full api database") t.Error("used full api database for case", testCase) } } }