Merge "apexDepsMutator is a top-down mutator" am: 680afd7bc7
am: 933fb89a3f
am: c798bcde06
Change-Id: I4695d3aa1231ff40d4a6570a0973360ebd9bf01d
This commit is contained in:
39
apex/apex.go
39
apex/apex.go
@@ -1025,7 +1025,7 @@ func RegisterPreDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
}
|
||||
|
||||
func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
ctx.BottomUp("apex_deps", apexDepsMutator)
|
||||
ctx.TopDown("apex_deps", apexDepsMutator)
|
||||
ctx.BottomUp("apex", apexMutator).Parallel()
|
||||
ctx.BottomUp("apex_flattened", apexFlattenedMutator).Parallel()
|
||||
ctx.BottomUp("apex_uses", apexUsesMutator).Parallel()
|
||||
@@ -1033,24 +1033,29 @@ func RegisterPostDepsMutators(ctx android.RegisterMutatorsContext) {
|
||||
|
||||
// Mark the direct and transitive dependencies of apex bundles so that they
|
||||
// can be built for the apex bundles.
|
||||
func apexDepsMutator(mctx android.BottomUpMutatorContext) {
|
||||
func apexDepsMutator(mctx android.TopDownMutatorContext) {
|
||||
var apexBundleNames []string
|
||||
var directDep bool
|
||||
if a, ok := mctx.Module().(*apexBundle); ok && !a.vndkApex {
|
||||
apexBundleName := mctx.ModuleName()
|
||||
mctx.WalkDeps(func(child, parent android.Module) bool {
|
||||
depName := mctx.OtherModuleName(child)
|
||||
// If the parent is apexBundle, this child is directly depended.
|
||||
_, directDep := parent.(*apexBundle)
|
||||
android.UpdateApexDependency(apexBundleName, depName, directDep)
|
||||
|
||||
if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() &&
|
||||
(directDep || am.DepIsInSameApex(mctx, child)) {
|
||||
am.BuildForApex(apexBundleName)
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
apexBundleNames = []string{mctx.ModuleName()}
|
||||
directDep = true
|
||||
} else if am, ok := mctx.Module().(android.ApexModule); ok {
|
||||
apexBundleNames = am.ApexVariations()
|
||||
directDep = false
|
||||
}
|
||||
|
||||
if len(apexBundleNames) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
mctx.VisitDirectDeps(func(child android.Module) {
|
||||
depName := mctx.OtherModuleName(child)
|
||||
if am, ok := child.(android.ApexModule); ok && am.CanHaveApexVariants() &&
|
||||
(directDep || am.DepIsInSameApex(mctx, child)) {
|
||||
android.UpdateApexDependency(apexBundleNames, depName, directDep)
|
||||
am.BuildForApexes(apexBundleNames)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Create apex variations if a module is included in APEX(s).
|
||||
|
Reference in New Issue
Block a user