summaryrefslogtreecommitdiff
path: root/java/lint.go
diff options
context:
space:
mode:
author ThiƩbaud Weksteen <tweek@google.com> 2023-09-29 10:21:56 +1000
committer ThiƩbaud Weksteen <tweek@google.com> 2023-09-29 10:24:13 +1000
commit9c0dff9ae5a6610ecbe4ad9d66cfa1e140367251 (patch)
treee9f2701ece06f2652b17a032eb5344064927abe4 /java/lint.go
parentf51ed265e45bea9c304b363c75e04dde1844e2ae (diff)
Add lint.suppress_exit_code attribute
The Android lint --exitcode parameter can be skipped using ANDROID_LINT_SUPPRESS_EXIT_CODE. Expose a similar attribute to Java modules to ignore the exit code. This is useful for integration testing. It is possible to build libraries that report an error when linted. Othewise, such module would break the checkbuild target. Bug: 302400088 Test: m nothing Change-Id: I372c42184f40d25753a688c380c0c63e9758ca00
Diffstat (limited to 'java/lint.go')
-rw-r--r--java/lint.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/java/lint.go b/java/lint.go
index f84f1c065..34720e51d 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -66,6 +66,10 @@ type LintProperties struct {
// 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 @@ func (l *linter) lint(ctx android.ModuleContext) {
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")
}