Reland^2 "m <apex_name>-deps-info prints the internal/external deps of the APEX"

This reverts commit 7cb4d378e7.

Test: m
Test: ALLOW_MISSING_DEPENDENCIES=true DIST_DIR=out/dist ./art/tools/dist_linux_bionic.sh -j80 com.android.art.host
(in the master-art-host branch)

Change-Id: I9beca73aafdf42f03bfa19cf1634b2641dac417b
This commit is contained in:
Jiyong Park
2020-01-14 18:38:44 +09:00
parent a7503367cf
commit 83dc74b770
9 changed files with 137 additions and 13 deletions

View File

@@ -554,3 +554,51 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
}
return ""
}
func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
if !a.primaryApexType {
return
}
if a.properties.IsCoverageVariant {
// Otherwise, we will have duplicated rules for coverage and
// non-coverage variants of the same APEX
return
}
if ctx.Host() {
// No need to generate dependency info for host variant
return
}
internalDeps := a.internalDeps
externalDeps := a.externalDeps
internalDeps = android.SortedUniqueStrings(internalDeps)
externalDeps = android.SortedUniqueStrings(externalDeps)
externalDeps = android.RemoveListFromList(externalDeps, internalDeps)
var content strings.Builder
for _, name := range internalDeps {
fmt.Fprintf(&content, "internal %s\\n", name)
}
for _, name := range externalDeps {
fmt.Fprintf(&content, "external %s\\n", name)
}
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(),
},
})
ctx.Build(pctx, android.BuildParams{
Rule: android.Phony,
Output: android.PathForPhony(ctx, a.Name()+"-deps-info"),
Inputs: []android.Path{depsInfoFile},
})
}