Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550 Merged-In: I4a6dd1c5e48db7085ea41035def31f0844948a46 Change-Id: If8ad1d0d87495bbd685f5f9f03f5eb7ea78bf192
This commit is contained in:
15
java/base.go
15
java/base.go
@@ -94,6 +94,9 @@ type CommonProperties struct {
|
||||
// if not blank, used as prefix to generate repackage rule
|
||||
Jarjar_prefix *string
|
||||
|
||||
// if set to true, skip the jarjar repackaging
|
||||
Skip_jarjar_repackage *bool
|
||||
|
||||
// If not blank, set the java version passed to javac as -source and -target
|
||||
Java_version *string
|
||||
|
||||
@@ -1109,11 +1112,13 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
jarjarProviderData := j.collectJarJarRules(ctx)
|
||||
if jarjarProviderData != nil {
|
||||
android.SetProvider(ctx, JarJarProvider, *jarjarProviderData)
|
||||
text := getJarJarRuleText(jarjarProviderData)
|
||||
if text != "" {
|
||||
ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
|
||||
android.WriteFileRule(ctx, ruleTextFile, text)
|
||||
j.repackageJarjarRules = ruleTextFile
|
||||
if !proptools.Bool(j.properties.Skip_jarjar_repackage) {
|
||||
text := getJarJarRuleText(jarjarProviderData)
|
||||
if text != "" {
|
||||
ruleTextFile := android.PathForModuleOut(ctx, "repackaged-jarjar", "repackaging.txt")
|
||||
android.WriteFileRule(ctx, ruleTextFile, text)
|
||||
j.repackageJarjarRules = ruleTextFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
22
java/lint.go
22
java/lint.go
@@ -319,25 +319,19 @@ func (l *linter) writeLintProjectXML(ctx android.ModuleContext, rule *android.Ru
|
||||
cmd.FlagWithInput("@",
|
||||
android.PathForSource(ctx, "build/soong/java/lint_defaults.txt"))
|
||||
|
||||
if l.compileSdkKind == android.SdkPublic {
|
||||
cmd.FlagForEachArg("--error_check ", l.extraMainlineLintErrors)
|
||||
} else {
|
||||
// TODO(b/268261262): Remove this branch. We're demoting NewApi to a warning due to pre-existing issues that need to be fixed.
|
||||
cmd.FlagForEachArg("--warning_check ", l.extraMainlineLintErrors)
|
||||
}
|
||||
cmd.FlagForEachArg("--error_check ", l.extraMainlineLintErrors)
|
||||
cmd.FlagForEachArg("--disable_check ", l.properties.Lint.Disabled_checks)
|
||||
cmd.FlagForEachArg("--warning_check ", l.properties.Lint.Warning_checks)
|
||||
cmd.FlagForEachArg("--error_check ", l.properties.Lint.Error_checks)
|
||||
cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks)
|
||||
|
||||
// TODO(b/193460475): Re-enable strict updatability linting
|
||||
//if l.GetStrictUpdatabilityLinting() {
|
||||
// // Verify the module does not baseline issues that endanger safe updatability.
|
||||
// if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() {
|
||||
// cmd.FlagWithInput("--baseline ", baselinePath.Path())
|
||||
// cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks)
|
||||
// }
|
||||
//}
|
||||
if l.GetStrictUpdatabilityLinting() {
|
||||
// Verify the module does not baseline issues that endanger safe updatability.
|
||||
if l.properties.Lint.Baseline_filename != nil {
|
||||
cmd.FlagWithInput("--baseline ", android.PathForModuleSrc(ctx, *l.properties.Lint.Baseline_filename))
|
||||
cmd.FlagForEachArg("--disallowed_issues ", updatabilityChecks)
|
||||
}
|
||||
}
|
||||
|
||||
return lintPaths{
|
||||
projectXML: projectXMLPath,
|
||||
|
@@ -91,9 +91,8 @@ func TestJavaLintUsesCorrectBpConfig(t *testing.T) {
|
||||
t.Error("did not use the correct file for baseline")
|
||||
}
|
||||
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--warning_check NewApi") {
|
||||
// TODO(b/268261262): Change this to check for --error_check
|
||||
t.Error("should check NewApi warnings")
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--error_check NewApi") {
|
||||
t.Error("should check NewApi errors")
|
||||
}
|
||||
|
||||
if !strings.Contains(*sboxProto.Commands[0].Command, "--error_check SomeCheck") {
|
||||
@@ -153,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 {
|
||||
|
Reference in New Issue
Block a user