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
diff --git a/apex/apex.go b/apex/apex.go
index b27b54e..aadc2c1 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -511,8 +511,13 @@
// list of files to be included in this apex
filesInfo []apexFile
- // list of module names that this APEX is depending on
+ // list of module names that should be installed along with this APEX
+ requiredDeps []string
+
+ // list of module names that this APEX is depending on (to be shown via *-deps-info target)
externalDeps []string
+ // list of module names that this APEX is including (to be shown via *-deps-info target)
+ internalDeps []string
testApex bool
vndkApex bool
@@ -925,7 +930,7 @@
a.primaryApexType = true
if ctx.Config().InstallExtraFlattenedApexes() {
- a.externalDeps = append(a.externalDeps, a.Name()+flattenedSuffix)
+ a.requiredDeps = append(a.requiredDeps, a.Name()+flattenedSuffix)
}
}
case zipApex:
@@ -984,6 +989,9 @@
depTag := ctx.OtherModuleDependencyTag(child)
depName := ctx.OtherModuleName(child)
if _, isDirectDep := parent.(*apexBundle); isDirectDep {
+ if depTag != keyTag && depTag != certificateTag {
+ a.internalDeps = append(a.internalDeps, depName)
+ }
switch depTag {
case sharedLibTag:
if cc, ok := child.(*cc.Module); ok {
@@ -1114,9 +1122,10 @@
//
// Always include if we are a host-apex however since those won't have any
// system libraries.
- if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.externalDeps) {
- a.externalDeps = append(a.externalDeps, cc.Name())
+ if !android.DirectlyInAnyApex(ctx, cc.Name()) && !android.InList(cc.Name(), a.requiredDeps) {
+ a.requiredDeps = append(a.requiredDeps, cc.Name())
}
+ a.externalDeps = append(a.externalDeps, depName)
requireNativeLibs = append(requireNativeLibs, cc.OutputFile().Path().Base())
// Don't track further
return false
@@ -1124,6 +1133,8 @@
af := apexFileForNativeLibrary(ctx, cc, handleSpecialLibs)
af.transitiveDep = true
filesInfo = append(filesInfo, af)
+ a.internalDeps = append(a.internalDeps, depName)
+ a.internalDeps = append(a.internalDeps, cc.AllStaticDeps()...)
return true // track transitive dependencies
}
} else if cc.IsTestPerSrcDepTag(depTag) {
@@ -1139,8 +1150,10 @@
return true // track transitive dependencies
}
} else if java.IsJniDepTag(depTag) {
- // Do nothing for JNI dep. JNI libraries are always embedded in APK-in-APEX.
+ a.externalDeps = append(a.externalDeps, depName)
return true
+ } else if java.IsStaticLibDepTag(depTag) {
+ a.internalDeps = append(a.internalDeps, depName)
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
ctx.ModuleErrorf("unexpected tag %q for indirect dependency %q", depTag, depName)
}
@@ -1238,6 +1251,7 @@
apexName := proptools.StringDefault(a.properties.Apex_name, a.Name())
a.compatSymlinks = makeCompatSymlinks(apexName, ctx)
+ a.buildApexDependencyInfo(ctx)
}
func newApexBundle() *apexBundle {