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
diff --git a/cc/cc.go b/cc/cc.go
index f6b1152..36b2f95 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1202,8 +1202,6 @@
if ccDep == nil {
// handling for a few module types that aren't cc Module but that are also supported
switch depTag {
- case android.DefaultsDepTag, android.SourceDepTag:
- // Nothing to do
case genSourceDepTag:
if genRule, ok := dep.(genrule.SourceFileGenerator); ok {
depPaths.GeneratedSources = append(depPaths.GeneratedSources,
@@ -1241,8 +1239,6 @@
} else {
ctx.ModuleErrorf("module %q is not a genrule", depName)
}
- default:
- ctx.ModuleErrorf("depends on non-cc module %q", depName)
}
return
}
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 42be88f..d03d4ee 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -163,8 +163,6 @@
if len(g.properties.Tools) > 0 {
ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) {
switch ctx.OtherModuleDependencyTag(module) {
- case android.SourceDepTag:
- // Nothing to do
case hostToolDepTag:
tool := ctx.OtherModuleName(module)
var path android.OptionalPath
@@ -201,8 +199,6 @@
} else {
ctx.ModuleErrorf("host tool %q missing output file", tool)
}
- default:
- ctx.ModuleErrorf("unknown dependency on %q", ctx.OtherModuleName(module))
}
})
}
diff --git a/java/droiddoc.go b/java/droiddoc.go
index beaec11..b641041 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -422,12 +422,16 @@
otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module)
- switch dep := module.(type) {
- case Dependency:
- switch tag {
- case bootClasspathTag:
+ switch tag {
+ case bootClasspathTag:
+ if dep, ok := module.(Dependency); ok {
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()...)
if otherName == String(j.properties.Srcs_lib) {
srcs := dep.(SrcDependency).CompiledSrcs()
@@ -447,12 +451,7 @@
}
deps.srcJars = append(deps.srcJars, dep.(SrcDependency).CompiledSrcJars()...)
}
- default:
- panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName()))
- }
- case SdkLibraryDependency:
- switch tag {
- case libTag:
+ case SdkLibraryDependency:
sdkVersion := String(j.properties.Sdk_version)
linkType := javaSdk
if strings.HasPrefix(sdkVersion, "system_") || strings.HasPrefix(sdkVersion, "test_") {
@@ -461,23 +460,9 @@
linkType = javaPlatform
}
deps.classpath = append(deps.classpath, dep.HeaderJars(linkType)...)
- default:
- ctx.ModuleErrorf("dependency on java_sdk_library %q can only be in libs", otherName)
- }
- case android.SourceFileProducer:
- switch tag {
- case libTag:
+ case android.SourceFileProducer:
checkProducesJars(ctx, dep)
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:
ctx.ModuleErrorf("depends on non-java module %q", otherName)
}