summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2024-11-20 21:10:40 +0000
committer Jihoon Kang <jihoonkang@google.com> 2024-11-20 21:37:26 +0000
commitf1e0ff0f855e45db33582f5329c9355011a828bb (patch)
treec411bccdbbb1b58030df621d021cf4a38866cc43 /java
parent458fde5f93d5127ea2cd82814f1178f9f678ba6b (diff)
Ensure that --revert-annotation flag is not generated for everything stubs
Currently, "--revert-annotations" argument is erroneously being added to "everything" stubs when no aconfig flags are defined. This change fixes this by ensuring that the argument is only generated for non-everything stubs. Test: m Bug: 379807097 Change-Id: Iafea74de07240ccf4a27badabd86203133e25697
Diffstat (limited to 'java')
-rw-r--r--java/droidstubs.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/java/droidstubs.go b/java/droidstubs.go
index bc2652797..e955949af 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -769,15 +769,6 @@ func addMetalavaConfigFilesToCmd(cmd *android.RuleBuilderCommand, configFiles an
// property is defined, apply transformations and only revert the flagged apis that are not
// enabled via release configurations and are not specified in aconfig_declarations
func generateRevertAnnotationArgs(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsType StubsType, aconfigFlagsPaths android.Paths) {
-
- if len(aconfigFlagsPaths) == 0 {
- cmd.Flag("--revert-annotation android.annotation.FlaggedApi")
- return
- }
-
- releasedFlaggedApisFile := android.PathForModuleOut(ctx, fmt.Sprintf("released-flagged-apis-%s.txt", stubsType.String()))
- revertAnnotationsFile := android.PathForModuleOut(ctx, fmt.Sprintf("revert-annotations-%s.txt", stubsType.String()))
-
var filterArgs string
switch stubsType {
// No flagged apis specific flags need to be passed to metalava when generating
@@ -799,6 +790,15 @@ func generateRevertAnnotationArgs(ctx android.ModuleContext, cmd *android.RuleBu
}
}
+ if len(aconfigFlagsPaths) == 0 {
+ // This argument should not be added for "everything" stubs
+ cmd.Flag("--revert-annotation android.annotation.FlaggedApi")
+ return
+ }
+
+ releasedFlaggedApisFile := android.PathForModuleOut(ctx, fmt.Sprintf("released-flagged-apis-%s.txt", stubsType.String()))
+ revertAnnotationsFile := android.PathForModuleOut(ctx, fmt.Sprintf("revert-annotations-%s.txt", stubsType.String()))
+
ctx.Build(pctx, android.BuildParams{
Rule: gatherReleasedFlaggedApisRule,
Inputs: aconfigFlagsPaths,