Merge "Make hiddenapi flag generation use new artifact"

This commit is contained in:
Anton Hansson 2020-10-12 16:08:11 +00:00 committed by Gerrit Code Review
commit 53781d55bc
1 changed files with 11 additions and 14 deletions

View File

@ -18,6 +18,7 @@ import (
"fmt" "fmt"
"android/soong/android" "android/soong/android"
"android/soong/genrule"
) )
func init() { func init() {
@ -223,30 +224,26 @@ func moduleForGreyListRemovedApis(ctx android.SingletonContext, module android.M
// the unsupported API. // the unsupported API.
func flagsRule(ctx android.SingletonContext) android.Path { func flagsRule(ctx android.SingletonContext) android.Path {
var flagsCSV android.Paths var flagsCSV android.Paths
var greylistRemovedApis android.Paths var combinedRemovedApis android.Path
ctx.VisitAllModules(func(module android.Module) { ctx.VisitAllModules(func(module android.Module) {
if h, ok := module.(hiddenAPIIntf); ok { if h, ok := module.(hiddenAPIIntf); ok {
if csv := h.flagsCSV(); csv != nil { if csv := h.flagsCSV(); csv != nil {
flagsCSV = append(flagsCSV, csv) flagsCSV = append(flagsCSV, csv)
} }
} else if ds, ok := module.(*Droidstubs); ok { } else if g, ok := module.(*genrule.Module); ok {
// Track @removed public and system APIs via corresponding droidstubs targets. if ctx.ModuleName(module) == "combined-removed-dex" {
// These APIs are not present in the stubs, however, we have to keep allowing access if len(g.GeneratedSourceFiles()) != 1 || combinedRemovedApis != nil {
// to them at runtime. ctx.Errorf("Expected 1 combined-removed-dex module that generates 1 output file.")
if moduleForGreyListRemovedApis(ctx, module) { }
greylistRemovedApis = append(greylistRemovedApis, ds.removedDexApiFile) combinedRemovedApis = g.GeneratedSourceFiles()[0]
} }
} }
}) })
combinedRemovedApis := android.PathForOutput(ctx, "hiddenapi", "combined-removed-dex.txt") if combinedRemovedApis == nil {
ctx.Build(pctx, android.BuildParams{ ctx.Errorf("Failed to find combined-removed-dex.")
Rule: android.Cat, }
Inputs: greylistRemovedApis,
Output: combinedRemovedApis,
Description: "Combine removed apis for " + combinedRemovedApis.String(),
})
rule := android.NewRuleBuilder() rule := android.NewRuleBuilder()