Merge "add walkPayloadDeps" am: 58b5030e30 am: 1cf0db8136 am: 230eceddce

Change-Id: Id9b071d99aa88fcfad5af8500836e0971f694647
This commit is contained in:
Automerger Merge Worker 2020-02-10 06:16:59 +00:00
commit 0ec2b81ee5
1 changed files with 23 additions and 17 deletions

View File

@ -1941,21 +1941,9 @@ func (c *flattenedApexContext) InstallBypassMake() bool {
return true
}
// Ensures that the dependencies are marked as available for this APEX
func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// Let's be practical. Availability for test, host, and the VNDK apex isn't important
if ctx.Host() || a.testApex || a.vndkApex {
return
}
checkDep := func(ctx android.ModuleContext, am android.ApexModule) {
apexName := ctx.ModuleName()
if am.AvailableFor(apexName) || whitelistedApexAvailable(apexName, am) {
return
}
ctx.ModuleErrorf("requires %q that is not available for the APEX.", am.Name())
}
// Visit dependencies that contributes to the payload of this APEX
func (a *apexBundle) walkPayloadDeps(ctx android.ModuleContext,
do func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool)) {
ctx.WalkDepsBlueprint(func(child, parent blueprint.Module) bool {
am, ok := child.(android.ApexModule)
if !ok || !am.CanHaveApexVariants() {
@ -1965,7 +1953,7 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// Check for the direct dependencies that contribute to the payload
if dt, ok := ctx.OtherModuleDependencyTag(child).(dependencyTag); ok {
if dt.payload {
checkDep(ctx, am)
do(ctx, parent, am, false /* externalDep */)
return true
}
return false
@ -1973,15 +1961,33 @@ func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// Check for the indirect dependencies if it is considered as part of the APEX
if am.DepIsInSameApex(ctx, am) {
checkDep(ctx, am)
do(ctx, parent, am, false /* externalDep */)
return true
}
do(ctx, parent, am, true /* externalDep */)
// As soon as the dependency graph crosses the APEX boundary, don't go further.
return false
})
}
// Ensures that the dependencies are marked as available for this APEX
func (a *apexBundle) checkApexAvailability(ctx android.ModuleContext) {
// Let's be practical. Availability for test, host, and the VNDK apex isn't important
if ctx.Host() || a.testApex || a.vndkApex {
return
}
a.walkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) {
apexName := ctx.ModuleName()
if externalDep || to.AvailableFor(apexName) || whitelistedApexAvailable(apexName, to) {
return
}
ctx.ModuleErrorf("requires %q that is not available for the APEX.", to.Name())
})
}
func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
buildFlattenedAsDefault := ctx.Config().FlattenApex() && !ctx.Config().UnbundledBuild()
switch a.properties.ApexType {