m <apex_name>-deps-info prints the internal/external deps of the APEX

We need to have a way to see the list of modules that directly or
indirectly contribute to an APEX. People find it difficult to determine
whether a module is included in which APEXes because APEX tracks
indirect dependencies as well as direct dependencies. Therefore, just
looking at Android.bp for the APEX itself doesn't give the answer.

This change adds a new make target <apex_name>-deps-info, which
generates out/soong/<apex_name>-deps-info.txt file that shows the
internal and external dependencies of the said APEX.
Here, internal means the dependencies are actually part of the
APEX, while external means the dependencies are still external to the
APEX.

Bug: 146323213
Test: m (apex_test amended)
Change-Id: I33d1ccf5d1ca335d71cd6ced0f5f66b8c3886d13
This commit is contained in:
Jiyong Park
2019-12-16 23:42:46 +09:00
parent e602918294
commit 114ff53f5e
8 changed files with 117 additions and 13 deletions

View File

@@ -398,6 +398,13 @@ func IsSharedDepTag(depTag blueprint.DependencyTag) bool {
return ok && ccDepTag.Shared
}
func IsStaticDepTag(depTag blueprint.DependencyTag) bool {
ccDepTag, ok := depTag.(DependencyTag)
return ok && (ccDepTag == staticExportDepTag ||
ccDepTag == lateStaticDepTag ||
ccDepTag == wholeStaticDepTag)
}
func IsRuntimeDepTag(depTag blueprint.DependencyTag) bool {
ccDepTag, ok := depTag.(DependencyTag)
return ok && ccDepTag == runtimeDepTag
@@ -463,6 +470,9 @@ type Module struct {
makeLinkType string
// Kythe (source file indexer) paths for this compilation module
kytheFiles android.Paths
// name of the modules that are direct or indirect static deps of this module
allStaticDeps []string
}
func (c *Module) Toc() android.OptionalPath {
@@ -1258,6 +1268,15 @@ func orderStaticModuleDeps(module LinkableInterface, staticDeps []LinkableInterf
return results
}
func gatherTransitiveStaticDeps(staticDeps []LinkableInterface) []string {
var ret []string
for _, dep := range staticDeps {
ret = append(ret, dep.Module().Name())
ret = append(ret, dep.AllStaticDeps()...)
}
return android.FirstUniqueStrings(ret)
}
func (c *Module) IsTestPerSrcAllTestsVariation() bool {
test, ok := c.linker.(testPerSrc)
return ok && test.isAllTestsVariation()
@@ -2328,6 +2347,8 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
c.sabi.Properties.ReexportedIncludes = android.FirstUniqueStrings(c.sabi.Properties.ReexportedIncludes)
}
c.allStaticDeps = gatherTransitiveStaticDeps(directStaticDeps)
return depPaths
}
@@ -2463,6 +2484,10 @@ func (c *Module) installable() bool {
return c.installer != nil && !c.Properties.PreventInstall && c.IsForPlatform() && c.outputFile.Valid()
}
func (c *Module) AllStaticDeps() []string {
return c.allStaticDeps
}
func (c *Module) AndroidMkWriteAdditionalDependenciesForSourceAbiDiff(w io.Writer) {
if c.linker != nil {
if library, ok := c.linker.(*libraryDecorator); ok {

View File

@@ -51,6 +51,8 @@ type LinkableInterface interface {
ToolchainLibrary() bool
NdkPrebuiltStl() bool
StubDecorator() bool
AllStaticDeps() []string
}
type DependencyTag struct {