Merge "Fix api_fingerprint.txt generation"

This commit is contained in:
Anton Hansson 2021-02-15 11:31:37 +00:00 committed by Gerrit Code Review
commit 404adeefdc

View file

@ -641,14 +641,26 @@ func createAPIFingerprint(ctx android.SingletonContext) {
if ctx.Config().PlatformSdkCodename() == "REL" {
cmd.Text("echo REL >").Output(out)
} else if !ctx.Config().AlwaysUsePrebuiltSdks() {
in, err := ctx.GlobWithDeps("frameworks/base/api/*current.txt", nil)
if err != nil {
ctx.Errorf("error globbing API files: %s", err)
} else if ctx.Config().FrameworksBaseDirExists(ctx) && !ctx.Config().AlwaysUsePrebuiltSdks() {
cmd.Text("cat")
apiTxtFileModules := []string{
"frameworks-base-api-current.txt",
"frameworks-base-api-system-current.txt",
"frameworks-base-api-module-lib-current.txt",
}
cmd.Text("cat").
Inputs(android.PathsForSource(ctx, in)).
count := 0
ctx.VisitAllModules(func(module android.Module) {
name := ctx.ModuleName(module)
if android.InList(name, apiTxtFileModules) {
cmd.Inputs(android.OutputFilesForModule(ctx, module, ""))
count++
}
})
if count != len(apiTxtFileModules) {
ctx.Errorf("Could not find all the expected API modules %v, found %d\n", apiTxtFileModules, count)
return
}
cmd.Input(android.PathForSource(ctx, "frameworks/base/services/api/current.txt")).
Text("| md5sum | cut -d' ' -f1 >").
Output(out)
} else {