Build a dependency graph

I am helping on plugin (generating Karaf feature files) where being able to access the “dependency graph” would be essentially needed. All the org.gradle.api.tasks.diagnostics.internal.DependencyReportRenderer stuff is internal. Is there a public-facing way to achieve this functionality?

Background…

The OSGi bundles named in the Karaf features file must be named “in order” (awesome, I know). “In order” here means that dependency bundles must be named before dependent bundles. E.g., if lib-a depends on lib-b, then Karaf requires that lib-b be installed first, which means that lib-b must be defined first in the feature file. Yes you can muck around with start-levels, but that still requires the same level of understanding of the relationship between the dependencies.

I’ll reply to myself…

You can do this, but the approach is unfortunately incubating. Then again, there is not much I have been able to do in Gradle without hitting one or more incubating APIs…

org.gradle.api.artifacts.Configuration#getIncoming -> org.gradle.api.artifacts.ResolvableDependencies#getResolutionResult