summaryrefslogtreecommitdiff
path: root/java/lint_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/lint_test.go')
-rw-r--r--java/lint_test.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/java/lint_test.go b/java/lint_test.go
index b51753f71..6b24daa5f 100644
--- a/java/lint_test.go
+++ b/java/lint_test.go
@@ -202,6 +202,71 @@ func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
}
}
+func TestJavaLintStrictUpdatabilityLintingMultipleParents(t *testing.T) {
+ bp := `
+ java_library {
+ name: "a",
+ srcs: ["a.java"],
+ static_libs: ["b"],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ lint: {
+ strict_updatability_linting: true,
+ baseline_filename: "lint-baseline.xml",
+ },
+ }
+
+ java_library {
+ name: "b",
+ srcs: ["b.java"],
+ static_libs: ["c"],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ lint: {
+ strict_updatability_linting: true,
+ },
+ }
+
+ java_library {
+ name: "d",
+ srcs: ["d.java"],
+ static_libs: ["c"],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ lint: {
+ strict_updatability_linting: true,
+ },
+ }
+
+ java_library {
+ name: "c",
+ srcs: ["c.java"],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ lint: {
+ baseline_filename: "lint-baseline.xml",
+ }
+ }
+ `
+ fs := android.MockFS{
+ "lint-baseline.xml": nil,
+ }
+
+ result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules, fs.AddToFixture()).
+ RunTestWithBp(t, bp)
+
+ c := result.ModuleForTests("c", "android_common")
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, c.Output("lint.sbox.textproto"))
+ if !strings.Contains(*sboxProto.Commands[0].Command,
+ "--baseline lint-baseline.xml --disallowed_issues NewApi") {
+ t.Error("did not restrict baselining NewApi")
+ }
+ if !strings.Contains(*sboxProto.Commands[0].Command,
+ "--strict_updatability_parents a,b,d") {
+ t.Errorf("Did not find correct strict_updatability_parents in command %q", *sboxProto.Commands[0].Command)
+ }
+}
+
func TestJavaLintDatabaseSelectionFull(t *testing.T) {
testCases := []struct {
sdk_version string