Convert Visit*Deps from blueprint.Module to android.Module

Also adds checks that the dependencies are android.Modules and
are not disabled.

Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
This commit is contained in:
Colin Cross
2017-10-23 17:59:01 -07:00
parent b671544973
commit d11fcda940
15 changed files with 166 additions and 67 deletions

View File

@@ -1037,16 +1037,10 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
directStaticDeps := []*Module{}
ctx.VisitDirectDeps(func(dep blueprint.Module) {
ctx.VisitDirectDeps(func(dep android.Module) {
depName := ctx.OtherModuleName(dep)
depTag := ctx.OtherModuleDependencyTag(dep)
aDep, _ := dep.(android.Module)
if aDep == nil {
ctx.ModuleErrorf("module %q not an android module", depName)
return
}
ccDep, _ := dep.(*Module)
if ccDep == nil {
// handling for a few module types that aren't cc Module but that are also supported
@@ -1096,20 +1090,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
return
}
// some validation
if !aDep.Enabled() {
if ctx.AConfig().AllowMissingDependencies() {
ctx.AddMissingDependencies([]string{depName})
} else {
ctx.ModuleErrorf("depends on disabled module %q", depName)
}
return
}
if aDep.Target().Os != ctx.Os() {
if dep.Target().Os != ctx.Os() {
ctx.ModuleErrorf("OS mismatch between %q and %q", ctx.ModuleName(), depName)
return
}
if aDep.Target().Arch.ArchType != ctx.Arch().ArchType {
if dep.Target().Arch.ArchType != ctx.Arch().ArchType {
ctx.ModuleErrorf("Arch mismatch between %q and %q", ctx.ModuleName(), depName)
return
}

View File

@@ -16,8 +16,6 @@ package cc
import (
"android/soong/android"
"github.com/google/blueprint"
)
type CoverageProperties struct {
@@ -61,7 +59,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {
// For static libraries, the only thing that changes our object files
// are included whole static libraries, so check to see if any of
// those have coverage enabled.
ctx.VisitDirectDeps(func(m blueprint.Module) {
ctx.VisitDirectDeps(func(m android.Module) {
if ctx.OtherModuleDependencyTag(m) != wholeStaticDepTag {
return
}
@@ -75,7 +73,7 @@ func (cov *coverage) flags(ctx ModuleContext, flags Flags) Flags {
} else {
// For executables and shared libraries, we need to check all of
// our static dependencies.
ctx.VisitDirectDeps(func(m blueprint.Module) {
ctx.VisitDirectDeps(func(m android.Module) {
cc, ok := m.(*Module)
if !ok || cc.coverage == nil {
return

View File

@@ -15,8 +15,6 @@
package cc
import (
"github.com/google/blueprint"
"android/soong/android"
)
@@ -104,7 +102,7 @@ func ltoDepsMutator(mctx android.TopDownMutatorContext) {
mctx.PropertyErrorf("LTO", "FullLTO and ThinLTO are mutually exclusive")
}
mctx.VisitDepsDepthFirst(func(m blueprint.Module) {
mctx.VisitDepsDepthFirst(func(m android.Module) {
tag := mctx.OtherModuleDependencyTag(m)
switch tag {
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag, objDepTag, reuseObjTag:

View File

@@ -17,8 +17,6 @@ package cc
import (
"strings"
"github.com/google/blueprint"
"android/soong/android"
"android/soong/cc/config"
)
@@ -81,7 +79,7 @@ func sabiDepsMutator(mctx android.TopDownMutatorContext) {
if c, ok := mctx.Module().(*Module); ok &&
((c.isVndk() && c.useVndk()) || inList(c.Name(), llndkLibraries) ||
(c.sabi != nil && c.sabi.Properties.CreateSAbiDumps)) {
mctx.VisitDirectDeps(func(m blueprint.Module) {
mctx.VisitDirectDeps(func(m android.Module) {
tag := mctx.OtherModuleDependencyTag(m)
switch tag {
case staticDepTag, staticExportDepTag, lateStaticDepTag, wholeStaticDepTag:

View File

@@ -19,8 +19,6 @@ import (
"io"
"strings"
"github.com/google/blueprint"
"android/soong/android"
"android/soong/cc/config"
)
@@ -493,7 +491,7 @@ func (sanitize *sanitize) SetSanitizer(t sanitizerType, b bool) {
func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
return func(mctx android.TopDownMutatorContext) {
if c, ok := mctx.Module().(*Module); ok && c.sanitize.Sanitizer(t) {
mctx.VisitDepsDepthFirst(func(module blueprint.Module) {
mctx.VisitDepsDepthFirst(func(module android.Module) {
if d, ok := mctx.Module().(*Module); ok && c.sanitize != nil &&
!c.sanitize.Properties.Sanitize.Never {
d.sanitize.Properties.SanitizeDep = true