Remove references to SourceDepTag in module types

SourceDepTag is going to become a set of tags of the same type
instead of a single tag, remove references to it outside the
android module.

Bug: 80144045
Test: soong tests
Change-Id: I00b2ea5040e4fc95dfbfdd79e21579853c478fcb
This commit is contained in:
Colin Cross
2018-05-23 10:59:18 -07:00
parent dd0b4e06f5
commit 2d24c1b654
3 changed files with 11 additions and 34 deletions

View File

@@ -1202,8 +1202,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
if ccDep == nil { if ccDep == nil {
// handling for a few module types that aren't cc Module but that are also supported // handling for a few module types that aren't cc Module but that are also supported
switch depTag { switch depTag {
case android.DefaultsDepTag, android.SourceDepTag:
// Nothing to do
case genSourceDepTag: case genSourceDepTag:
if genRule, ok := dep.(genrule.SourceFileGenerator); ok { if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
depPaths.GeneratedSources = append(depPaths.GeneratedSources, depPaths.GeneratedSources = append(depPaths.GeneratedSources,
@@ -1241,8 +1239,6 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
} else { } else {
ctx.ModuleErrorf("module %q is not a genrule", depName) ctx.ModuleErrorf("module %q is not a genrule", depName)
} }
default:
ctx.ModuleErrorf("depends on non-cc module %q", depName)
} }
return return
} }

View File

@@ -163,8 +163,6 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(g.properties.Tools) > 0 { if len(g.properties.Tools) > 0 {
ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) { ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) {
switch ctx.OtherModuleDependencyTag(module) { switch ctx.OtherModuleDependencyTag(module) {
case android.SourceDepTag:
// Nothing to do
case hostToolDepTag: case hostToolDepTag:
tool := ctx.OtherModuleName(module) tool := ctx.OtherModuleName(module)
var path android.OptionalPath var path android.OptionalPath
@@ -201,8 +199,6 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
} else { } else {
ctx.ModuleErrorf("host tool %q missing output file", tool) ctx.ModuleErrorf("host tool %q missing output file", tool)
} }
default:
ctx.ModuleErrorf("unknown dependency on %q", ctx.OtherModuleName(module))
} }
}) })
} }

View File

@@ -422,12 +422,16 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
otherName := ctx.OtherModuleName(module) otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module) tag := ctx.OtherModuleDependencyTag(module)
switch dep := module.(type) { switch tag {
case Dependency: case bootClasspathTag:
switch tag { if dep, ok := module.(Dependency); ok {
case bootClasspathTag:
deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars()...) deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars()...)
case libTag: } else {
panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
}
case libTag:
switch dep := module.(type) {
case Dependency:
deps.classpath = append(deps.classpath, dep.ImplementationJars()...) deps.classpath = append(deps.classpath, dep.ImplementationJars()...)
if otherName == String(j.properties.Srcs_lib) { if otherName == String(j.properties.Srcs_lib) {
srcs := dep.(SrcDependency).CompiledSrcs() srcs := dep.(SrcDependency).CompiledSrcs()
@@ -447,12 +451,7 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
} }
deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...) deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...)
} }
default: case SdkLibraryDependency:
panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
}
case SdkLibraryDependency:
switch tag {
case libTag:
sdkVersion := String(j.properties.Sdk_version) sdkVersion := String(j.properties.Sdk_version)
linkType := javaSdk linkType := javaSdk
if strings.HasPrefix(sdkVersion, "system_") || strings.HasPrefix(sdkVersion, "test_") { if strings.HasPrefix(sdkVersion, "system_") || strings.HasPrefix(sdkVersion, "test_") {
@@ -461,23 +460,9 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps {
linkType = javaPlatform linkType = javaPlatform
} }
deps.classpath = append(deps.classpath, dep.HeaderJars(linkType)...) deps.classpath = append(deps.classpath, dep.HeaderJars(linkType)...)
default: case android.SourceFileProducer:
ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName)
}
case android.SourceFileProducer:
switch tag {
case libTag:
checkProducesJars(ctx, dep) checkProducesJars(ctx, dep)
deps.classpath = append(deps.classpath, dep.Srcs()...) deps.classpath = append(deps.classpath, dep.Srcs()...)
case android.DefaultsDepTag, android.SourceDepTag:
// Nothing to do
default:
ctx.ModuleErrorf("dependency on genrule %q may only be in srcs, libs", otherName)
}
default:
switch tag {
case android.DefaultsDepTag, android.SourceDepTag, droiddocTemplateTag:
// Nothing to do
default: default:
ctx.ModuleErrorf("depends on non-java module %q", otherName) ctx.ModuleErrorf("depends on non-java module %q", otherName)
} }