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
diff --git a/java/robolectric.go b/java/robolectric.go
index c821e5b..98bb710 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -148,10 +148,10 @@
}
for _, dep := range ctx.GetDirectDepsWithTag(libTag) {
- m := dep.(Dependency)
- r.libs = append(r.libs, m.BaseModuleName())
- if !android.InList(m.BaseModuleName(), config.FrameworkLibraries) {
- combinedJarJars = append(combinedJarJars, m.ImplementationAndResourcesJars()...)
+ m := ctx.OtherModuleProvider(dep, JavaInfoProvider).(JavaInfo)
+ r.libs = append(r.libs, ctx.OtherModuleName(dep))
+ if !android.InList(ctx.OtherModuleName(dep), config.FrameworkLibraries) {
+ combinedJarJars = append(combinedJarJars, m.ImplementationAndResourcesJars...)
}
}
@@ -245,10 +245,10 @@
srcJarDeps := append(android.Paths(nil), instrumentedApp.srcJarDeps...)
for _, m := range ctx.GetDirectDepsWithTag(roboCoverageLibsTag) {
- if dep, ok := m.(Dependency); ok {
- depSrcJarArgs, depSrcJarDeps := dep.SrcJarArgs()
- srcJarArgs = append(srcJarArgs, depSrcJarArgs...)
- srcJarDeps = append(srcJarDeps, depSrcJarDeps...)
+ if ctx.OtherModuleHasProvider(m, JavaInfoProvider) {
+ dep := ctx.OtherModuleProvider(m, JavaInfoProvider).(JavaInfo)
+ srcJarArgs = append(srcJarArgs, dep.SrcJarArgs...)
+ srcJarDeps = append(srcJarDeps, dep.SrcJarDeps...)
}
}