Fix api_fingerprint.txt generation

Use the generated txt files as input instead
of globbing for now non-existent files.

Also add the system server api txt to the hash.

Bug: 179807354
Test: verify out/soong/api_fingerprint.txt changes now
Test: verify the command in the ninja file looks ok:
      grep api_fingerprint out/soong/build.ninja
Change-Id: I7a49ca134eb93b22537a4f3054285eb15f8c4256
This commit is contained in:
Anton Hansson
2021-02-10 14:52:42 +00:00
parent 89886cbdb0
commit 973d31c757

View File

@@ -640,14 +640,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 {