diff options
author | 2021-02-01 13:59:03 -0800 | |
---|---|---|
committer | 2021-02-09 15:36:25 -0800 | |
commit | dcf71b299ca9c85a31f9b895d8e8529d03cd7e04 (patch) | |
tree | 9010ad5f799f7df0589c824310d1e33720ca56ed /java/droiddoc.go | |
parent | a6cfcac7279755c76ab742f21e29f0ab3de2c7ea (diff) |
Convert java.Dependency to JavaInfo provider
Export information about java dependencies through a Provider
instead of accessing the module directly.
Test: java_test.go
Test: no changes to build.ninja
Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
Diffstat (limited to 'java/droiddoc.go')
-rw-r--r-- | java/droiddoc.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/java/droiddoc.go b/java/droiddoc.go index c74009ea4..8f1644c7f 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -470,8 +470,9 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { switch tag { case bootClasspathTag: - if dep, ok := module.(Dependency); ok { - deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars()...) + if ctx.OtherModuleHasProvider(module, JavaInfoProvider) { + dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo) + deps.bootClasspath = append(deps.bootClasspath, dep.ImplementationJars...) } else if sm, ok := module.(SystemModulesProvider); ok { // A system modules dependency has been added to the bootclasspath // so add its libs to the bootclasspath. @@ -480,23 +481,23 @@ func (j *Javadoc) collectDeps(ctx android.ModuleContext) deps { panic(fmt.Errorf("unknown dependency %q for %q", otherName, ctx.ModuleName())) } case libTag: - switch dep := module.(type) { - case SdkLibraryDependency: + if dep, ok := module.(SdkLibraryDependency); ok { deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.sdkVersion())...) - case Dependency: - deps.classpath = append(deps.classpath, dep.HeaderJars()...) - deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs()...) - case android.SourceFileProducer: + } else if ctx.OtherModuleHasProvider(module, JavaInfoProvider) { + dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo) + deps.classpath = append(deps.classpath, dep.HeaderJars...) + deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, dep.AidlIncludeDirs...) + } else if dep, ok := module.(android.SourceFileProducer); ok { checkProducesJars(ctx, dep) deps.classpath = append(deps.classpath, dep.Srcs()...) - default: + } else { ctx.ModuleErrorf("depends on non-java module %q", otherName) } case java9LibTag: - switch dep := module.(type) { - case Dependency: - deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars()...) - default: + if ctx.OtherModuleHasProvider(module, JavaInfoProvider) { + dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo) + deps.java9Classpath = append(deps.java9Classpath, dep.HeaderJars...) + } else { ctx.ModuleErrorf("depends on non-java module %q", otherName) } case systemModulesTag: |