Export depsInfo into android package.

Move depsInfo into android for easier sharing with APK code.

Bug: 149622332
Test: m, diff'ing outputs for conscrypt module.
Change-Id: If0ee967d37425540e69b4ce9304229d9f2cd86bd
This commit is contained in:
Artur Satayev
2020-04-27 17:08:37 +01:00
parent 9d6ea77c52
commit 872a144dca
4 changed files with 78 additions and 56 deletions

View File

@@ -18,6 +18,7 @@ import (
"fmt"
"sort"
"strconv"
"strings"
"sync"
"github.com/google/blueprint"
@@ -403,3 +404,52 @@ func InitApexModule(m ApexModule) {
m.AddProperties(&base.ApexProperties)
}
// A dependency info for a single ApexModule, either direct or transitive.
type ApexModuleDepInfo struct {
// Name of the dependency
To string
// List of dependencies To belongs to. Includes APEX itself, if a direct dependency.
From []string
// Whether the dependency belongs to the final compiled APEX.
IsExternal bool
}
// A map of a dependency name to its ApexModuleDepInfo
type DepNameToDepInfoMap map[string]ApexModuleDepInfo
type ApexBundleDepsInfo struct {
fullListPath OutputPath
}
type ApexDepsInfoIntf interface {
FullListPath() Path
}
func (d *ApexBundleDepsInfo) FullListPath() Path {
return d.fullListPath
}
var _ ApexDepsInfoIntf = (*ApexBundleDepsInfo)(nil)
func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, depInfos DepNameToDepInfoMap) {
var content strings.Builder
for _, key := range FirstUniqueStrings(SortedStringKeys(depInfos)) {
info := depInfos[key]
toName := info.To
if info.IsExternal {
toName = toName + " (external)"
}
fmt.Fprintf(&content, "%s <- %s\\n", toName, strings.Join(SortedUniqueStrings(info.From), ", "))
}
d.fullListPath = PathForModuleOut(ctx, "depsinfo", "fulllist.txt").OutputPath
ctx.Build(pctx, BuildParams{
Rule: WriteFile,
Description: "Full Dependency Info",
Output: d.fullListPath,
Args: map[string]string{
"content": content.String(),
},
})
}