Allow module SDK snapshot build to hide flagged APIs

Temporary workaround to allow module SDK snapshot builds to hide
flagged APIs until such time as development moves to `main` and
the build in `main` can handle that properly.

Bug: 299570421
Test: UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true vendor/google/build/mainline_modules_sdks.sh
      # Check that flagged APIs are excluded from everything but
      # for-latest-build.
Change-Id: I5b133b98aab91b2ad5ba717dd663c60a5ed90c9d
Merged-In: I4967376c0236bad729398af80fa59b48dbab5f21
This commit is contained in:
Paul Duffin
2023-11-24 15:55:39 +00:00
parent e497db9efc
commit 8d6ba4367d

View File

@@ -544,6 +544,15 @@ func metalavaCmd(ctx android.ModuleContext, rule *android.RuleBuilder, javaVersi
// information.
cmd.FlagWithArg("--format-defaults ", "overloaded-method-order=source,add-additional-overrides=yes")
// If requested hide the flagged APIs from the output of metalava. This
// should be implemented in the module SDK snapshot code by depending on
// special metalava rules that hide the flagged APIs but that will take
// lots of work. In the meantime, this is a temporary workaround that
// can and will only be used when building module SDK snapshots.
if ctx.Config().GetenvWithDefault("SOONG_SDK_SNAPSHOT_HIDE_FLAGGED_APIS", "false") == "true" {
cmd.Flag("--hide-annotation android.annotation.FlaggedApi")
}
return cmd
}