Merge changes from topic "linter_integration_tests" into main
* changes:
Add .lint tagged output to Java modules
Add lint.suppress_exit_code attribute
diff --git a/java/base.go b/java/base.go
index db237da..4168e08 100644
--- a/java/base.go
+++ b/java/base.go
@@ -641,6 +641,11 @@
return nil, fmt.Errorf("%q was requested, but no output file was found.", tag)
case ".generated_srcjars":
return j.properties.Generated_srcjars, nil
+ case ".lint":
+ if j.linter.outputs.xml != nil {
+ return android.Paths{j.linter.outputs.xml}, nil
+ }
+ return nil, fmt.Errorf("%q was requested, but no output file was found.", tag)
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
diff --git a/java/lint.go b/java/lint.go
index f84f1c0..34720e5 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -66,6 +66,10 @@
// This will be true by default for test module types, false otherwise.
// If soong gets support for testonly, this flag should be replaced with that.
Test *bool
+
+ // Whether to ignore the exit code of Android lint. This is the --exit_code
+ // option. Defaults to false.
+ Suppress_exit_code *bool
}
}
@@ -504,7 +508,8 @@
rule.Temporary(lintPaths.projectXML)
rule.Temporary(lintPaths.configXML)
- if exitCode := ctx.Config().Getenv("ANDROID_LINT_SUPPRESS_EXIT_CODE"); exitCode == "" {
+ suppressExitCode := BoolDefault(l.properties.Lint.Suppress_exit_code, false)
+ if exitCode := ctx.Config().Getenv("ANDROID_LINT_SUPPRESS_EXIT_CODE"); exitCode == "" && !suppressExitCode {
cmd.Flag("--exitcode")
}