summaryrefslogtreecommitdiff
path: root/java/hiddenapi_singleton.go
diff options
context:
space:
mode:
authorAnton Hansson <hansson@google.com>2020-10-12 16:08:11 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-10-12 16:08:11 +0000
commit53781d55bcce9d61bf67b61c46c300c0ec52fa61 (patch)
tree4e9752b611b86c3006fa6690f479ac9b10926f6e /java/hiddenapi_singleton.go
parentf43eee4b9bce77ec5bf137e7b95c574237a0dc0d (diff)
parentb3cbd6184633c9f2d159b482e278654caf489bbe (diff)
Merge "Make hiddenapi flag generation use new artifact"
Diffstat (limited to 'java/hiddenapi_singleton.go')
-rw-r--r--java/hiddenapi_singleton.go25
1 files changed, 11 insertions, 14 deletions
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index b140b899b..9d07e41c9 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -18,6 +18,7 @@ import (
"fmt"
"android/soong/android"
+ "android/soong/genrule"
)
func init() {
@@ -223,30 +224,26 @@ func moduleForGreyListRemovedApis(ctx android.SingletonContext, module android.M
// the unsupported API.
func flagsRule(ctx android.SingletonContext) android.Path {
var flagsCSV android.Paths
- var greylistRemovedApis android.Paths
+ var combinedRemovedApis android.Path
ctx.VisitAllModules(func(module android.Module) {
if h, ok := module.(hiddenAPIIntf); ok {
if csv := h.flagsCSV(); csv != nil {
flagsCSV = append(flagsCSV, csv)
}
- } else if ds, ok := module.(*Droidstubs); ok {
- // Track @removed public and system APIs via corresponding droidstubs targets.
- // These APIs are not present in the stubs, however, we have to keep allowing access
- // to them at runtime.
- if moduleForGreyListRemovedApis(ctx, module) {
- greylistRemovedApis = append(greylistRemovedApis, ds.removedDexApiFile)
+ } else if g, ok := module.(*genrule.Module); ok {
+ if ctx.ModuleName(module) == "combined-removed-dex" {
+ if len(g.GeneratedSourceFiles()) != 1 || combinedRemovedApis != nil {
+ ctx.Errorf("Expected 1 combined-removed-dex module that generates 1 output file.")
+ }
+ combinedRemovedApis = g.GeneratedSourceFiles()[0]
}
}
})
- combinedRemovedApis := android.PathForOutput(ctx, "hiddenapi", "combined-removed-dex.txt")
- ctx.Build(pctx, android.BuildParams{
- Rule: android.Cat,
- Inputs: greylistRemovedApis,
- Output: combinedRemovedApis,
- Description: "Combine removed apis for " + combinedRemovedApis.String(),
- })
+ if combinedRemovedApis == nil {
+ ctx.Errorf("Failed to find combined-removed-dex.")
+ }
rule := android.NewRuleBuilder()