summaryrefslogtreecommitdiff
path: root/java/hiddenapi_singleton.go
diff options
context:
space:
mode:
author Anton Hansson <hansson@google.com> 2020-10-06 12:04:34 +0100
committer Anton Hansson <hansson@google.com> 2020-10-07 12:28:23 +0100
commitb3cbd6184633c9f2d159b482e278654caf489bbe (patch)
tree168f366e66d995f19b575420a0d20db1d17cbb43 /java/hiddenapi_singleton.go
parentecf5435590a1a891774ba3cf4e9b9f8a4c4298ef (diff)
Make hiddenapi flag generation use new artifact
Use the output of new genrule combined-removed-dex instead of the removedDexApi output from various metalava runs when generating the hiddenapi-flags.csv file. There are some minor difference in the two combined-removed-dex files, but these diffs do not amount to any diffs in the generated hiddenapi-flags.csv file. See the full set of diffs here: https://paste.googleplex.com/6632343525654528 Bug: 158465496 Test: diff hiddenapi-flags.csv before and after Change-Id: I082d18fc2b8a57ea8c5941d5c955a7970ab9d860
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 61a9b97e4..d1bd73977 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() {
@@ -224,30 +225,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()