Treat lint warnings as errors

Warnings get lost in the build spam and never get fixed. Right now is
the best time to do this, because we only track the warnings/errors
since the last released API. The API has just been frozen, so the number
of warnings is at an all-time low.

Whitelist the car lib and test stubs for now, which produce a lot of
warnings.

Bug: 154317059
Test: presubmit
Change-Id: I9aa7cb1b947c6c664f15e2bd5835d76eaac1237a
This commit is contained in:
Anton Hansson 2020-05-04 18:38:46 +01:00
parent 7b6af23db6
commit e714565ce8

View file

@ -1471,6 +1471,15 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
cmd := metalavaCmd(ctx, rule, javaVersion, d.Javadoc.srcFiles, srcJarList,
deps.bootClasspath, deps.classpath, d.Javadoc.sourcepaths)
// TODO(b/154317059): Clean up this whitelist by baselining and/or checking in last-released.
if d.Name() != "android.car-system-stubs-docs" &&
d.Name() != "android.car-stubs-docs" &&
d.Name() != "system-api-stubs-docs" &&
d.Name() != "test-api-stubs-docs" {
cmd.Flag("--lints-as-errors")
cmd.Flag("--warnings-as-errors") // Most lints are actually warnings.
}
cmd.Flag(d.Javadoc.args).Implicits(d.Javadoc.argFiles)
newSince := android.OptionalPathForModuleSrc(ctx, d.properties.Check_api.Api_lint.New_since)