Re-enable strict updatability linting

Now that all use cases where it would've errored on are removed.

Ignore-AOSP-First: the properties were only removed in internal main to make the LSC smaller
Bug: 320698986
Test: m nothing --no-skip-soong-tests, and also locally edited soong to add a quick build that runs all the strict updatability checks in the tree and ran that
Change-Id: If9e23327a3c0944cc8c6849914fe51dc48bdb626
This commit is contained in:
Cole Faust
2024-01-19 14:12:17 -08:00
parent e5d89e4da1
commit 24e25c0499
3 changed files with 246 additions and 236 deletions

View File

@@ -152,52 +152,55 @@ func TestJavaLintBypassUpdatableChecks(t *testing.T) {
}
}
// TODO(b/193460475): Re-enable this test
//func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
// bp := `
// java_library {
// name: "foo",
// srcs: [
// "a.java",
// ],
// static_libs: ["bar"],
// min_sdk_version: "29",
// sdk_version: "current",
// lint: {
// strict_updatability_linting: true,
// },
// }
//
// java_library {
// name: "bar",
// srcs: [
// "a.java",
// ],
// min_sdk_version: "29",
// sdk_version: "current",
// }
// `
// fs := android.MockFS{
// "lint-baseline.xml": nil,
// }
//
// result := android.GroupFixturePreparers(PrepareForTestWithJavaDefaultModules, fs.AddToFixture()).
// RunTestWithBp(t, bp)
//
// foo := result.ModuleForTests("foo", "android_common")
// sboxProto := android.RuleBuilderSboxProtoForTests(t, foo.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")
// }
//
// bar := result.ModuleForTests("bar", "android_common")
// sboxProto = android.RuleBuilderSboxProtoForTests(t, bar.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")
// }
//}
func TestJavaLintStrictUpdatabilityLinting(t *testing.T) {
bp := `
java_library {
name: "foo",
srcs: [
"a.java",
],
static_libs: ["bar"],
min_sdk_version: "29",
sdk_version: "current",
lint: {
strict_updatability_linting: true,
baseline_filename: "lint-baseline.xml",
},
}
java_library {
name: "bar",
srcs: [
"a.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)
foo := result.ModuleForTests("foo", "android_common")
sboxProto := android.RuleBuilderSboxProtoForTests(t, result.TestContext, foo.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")
}
bar := result.ModuleForTests("bar", "android_common")
sboxProto = android.RuleBuilderSboxProtoForTests(t, result.TestContext, bar.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")
}
}
func TestJavaLintDatabaseSelectionFull(t *testing.T) {
testCases := []struct {