aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2023-11-24 15:55:39 +0000
committerPaul Duffin <paulduffin@google.com>2023-11-27 08:23:24 +0000
commit8d6ba4367d853f5d7227ab7ccc9b0512b1191417 (patch)
treecdc1880ba8de65fc800a2da2aabd58d03f9d2885
parente497db9efcb043ebbac2559fa929d430bafd86e1 (diff)
downloadsoong-8d6ba4367d853f5d7227ab7ccc9b0512b1191417.tar.gz
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
-rw-r--r--java/droidstubs.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/java/droidstubs.go b/java/droidstubs.go
index a9e20e03f..eaf388740 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -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
}