Add dependency tags to apex available errors

Having dependency tags in the dependency path that shows why a specific
module is considered part of an apex makes it easier to understand why
that is the case and detect possible issues.

Bug: 152762638
Bug: 153306490
Test: m nothing
Merged-In: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
Change-Id: Iba2a8a5a6abe03dadee456e760aa4373cd00c07b
This commit is contained in:
Paul Duffin
2020-03-31 11:31:36 +01:00
parent 03e7d0ca9c
commit f020796cad
3 changed files with 45 additions and 2 deletions

View File

@@ -128,6 +128,13 @@ type BaseModuleContext interface {
// and returns a top-down dependency path from a start module to current child module.
GetWalkPath() []Module
// GetTagPath is supposed to be called in visit function passed in WalkDeps()
// and returns a top-down dependency tags path from a start module to current child module.
// It has one less entry than GetWalkPath() as it contains the dependency tags that
// exist between each adjacent pair of modules in the GetWalkPath().
// GetTagPath()[i] is the tag between GetWalkPath()[i] and GetWalkPath()[i+1]
GetTagPath() []blueprint.DependencyTag
AddMissingDependencies(missingDeps []string)
Target() Target
@@ -1386,6 +1393,7 @@ type baseModuleContext struct {
debug bool
walkPath []Module
tagPath []blueprint.DependencyTag
strictVisitDeps bool // If true, enforce that all dependencies are enabled
}
@@ -1675,6 +1683,7 @@ func (b *baseModuleContext) WalkDepsBlueprint(visit func(blueprint.Module, bluep
func (b *baseModuleContext) WalkDeps(visit func(Module, Module) bool) {
b.walkPath = []Module{b.Module()}
b.tagPath = []blueprint.DependencyTag{}
b.bp.WalkDeps(func(child, parent blueprint.Module) bool {
childAndroidModule, _ := child.(Module)
parentAndroidModule, _ := parent.(Module)
@@ -1682,8 +1691,10 @@ func (b *baseModuleContext) WalkDeps(visit func(Module, Module) bool) {
// record walkPath before visit
for b.walkPath[len(b.walkPath)-1] != parentAndroidModule {
b.walkPath = b.walkPath[0 : len(b.walkPath)-1]
b.tagPath = b.tagPath[0 : len(b.tagPath)-1]
}
b.walkPath = append(b.walkPath, childAndroidModule)
b.tagPath = append(b.tagPath, b.OtherModuleDependencyTag(childAndroidModule))
return visit(childAndroidModule, parentAndroidModule)
} else {
return false
@@ -1695,6 +1706,10 @@ func (b *baseModuleContext) GetWalkPath() []Module {
return b.walkPath
}
func (b *baseModuleContext) GetTagPath() []blueprint.DependencyTag {
return b.tagPath
}
func (m *moduleContext) VisitAllModuleVariants(visit func(Module)) {
m.bp.VisitAllModuleVariants(func(module blueprint.Module) {
visit(module.(Module))