From e714565ce8f090d8615381ce9df28ac8ff2c49f0 Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Mon, 4 May 2020 18:38:46 +0100 Subject: [PATCH] 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 --- java/droiddoc.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/java/droiddoc.go b/java/droiddoc.go index 1e950c13c..62675c46a 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -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)