Merge "Export depsInfo into android package." am: 57769e469b am: ed11483aa6

Change-Id: I103c2e1f0eada4b1cd516cc1a24625d680627824
This commit is contained in:
satayev
2020-05-05 10:30:28 +00:00
committed by Automerger Merge Worker
4 changed files with 78 additions and 56 deletions

View File

@@ -688,29 +688,37 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
return
}
var content strings.Builder
for _, key := range android.SortedStringKeys(a.depInfos) {
info := a.depInfos[key]
toName := info.to
if info.isExternal {
toName = toName + " (external)"
depInfos := android.DepNameToDepInfoMap{}
a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
if from.Name() == to.Name() {
// This can happen for cc.reuseObjTag. We are not interested in tracking this.
// As soon as the dependency graph crosses the APEX boundary, don't go further.
return !externalDep
}
fmt.Fprintf(&content, "%s <- %s\\n", toName, strings.Join(android.SortedUniqueStrings(info.from), ", "))
}
depsInfoFile := android.PathForOutput(ctx, a.Name()+"-deps-info.txt")
ctx.Build(pctx, android.BuildParams{
Rule: android.WriteFile,
Description: "Dependency Info",
Output: depsInfoFile,
Args: map[string]string{
"content": content.String(),
},
if info, exists := depInfos[to.Name()]; exists {
if !android.InList(from.Name(), info.From) {
info.From = append(info.From, from.Name())
}
info.IsExternal = info.IsExternal && externalDep
depInfos[to.Name()] = info
} else {
depInfos[to.Name()] = android.ApexModuleDepInfo{
To: to.Name(),
From: []string{from.Name()},
IsExternal: externalDep,
}
}
// As soon as the dependency graph crosses the APEX boundary, don't go further.
return !externalDep
})
a.ApexBundleDepsInfo.BuildDepsInfoLists(ctx, depInfos)
ctx.Build(pctx, android.BuildParams{
Rule: android.Phony,
Output: android.PathForPhony(ctx, a.Name()+"-deps-info"),
Inputs: []android.Path{depsInfoFile},
Inputs: []android.Path{a.ApexBundleDepsInfo.FullListPath()},
})
}