Merge changes from topic "linter_integration_tests" into main am: 77b232da24 am: 11e2cee9a6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2769019

Change-Id: Id42122ad6f40e317cec4a05e0989f15197d22d0b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Thiébaud Weksteen 2023-10-02 23:59:43 +00:00 committed by Automerger Merge Worker
commit 9e0a9d859a
2 changed files with 11 additions and 1 deletions

View file

@ -641,6 +641,11 @@ func (j *Module) OutputFiles(tag string) (android.Paths, error) {
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)
}

View file

@ -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")
}