From 88d3b398469774557d040daee116b38bea0f0312 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 28 Aug 2024 17:37:36 +0100 Subject: [PATCH] Report UnflaggedApi issues as warnings but treat as errors when new The `UnflaggedApi` issue is only reported when doing API linting and defaults to `Severity.HIDDEN` because AndroidX (among other users) do not support using `@FlaggedApi` annotations. This change switches it to be warning by default in the Android build as there are some existing instances of it, but will be treated as an error by the "Build Warnings Aye Aye Analyzer" in a Gerrit change if it occurs on lines that are modified/added by that change. Bug: 361582214 Test: m checkapi Change-Id: Ie5ed23d00dd49454aeb5b43ccd8ad027d9d34fd2 --- java/droidstubs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/droidstubs.go b/java/droidstubs.go index d6229038f..137ec9254 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -970,6 +970,11 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro d.apiLintReport = android.PathForModuleOut(ctx, Everything.String(), "api_lint_report.txt") cmd.FlagWithOutput("--report-even-if-suppressed ", d.apiLintReport) // TODO: Change to ":api-lint" + // Make sure that existing UnflaggedApi issues are reported as warnings but issues in + // new/changed code are treated as errors by the Build Warnings Aye Aye Analyzer in Gerrit. + // Once existing issues have been fixed this will be changed to error. + cmd.Flag("--error-when-new UnflaggedApi") + // TODO(b/154317059): Clean up this allowlist by baselining and/or checking in last-released. if d.Name() != "android.car-system-stubs-docs" && d.Name() != "android.car-stubs-docs" {