@@ -30,6 +30,8 @@ internal class GraphViewBuilder(
3030 private val componentFilter: (ResolvedDependencyResult ) -> Boolean = {
3131 ! localOnly || it.selected.id is ProjectComponentIdentifier
3232 }
33+ private val comparator = compareBy<Pair <ResolvedDependencyResult , Coordinates >> { it.second.javaClass.simpleName }
34+ .thenComparing { pair -> pair.second.identifier }
3335
3436 init {
3537 val rootId = root.rootCoordinates()
@@ -56,21 +58,18 @@ internal class GraphViewBuilder(
5658 .filter(componentFilter)
5759 // AGP adds all runtime dependencies as constraints to the compile classpath, and these show
5860 // up in the resolution result. Filter them out.
59- .filterNot { it. isConstraint }
61+ .filterNot( ResolvedDependencyResult :: isConstraint)
6062 // For similar reasons as above
61- .filterNot { it.isJavaPlatform() }
63+ .filterNot( ResolvedDependencyResult ::isJavaPlatform)
6264 // Sometimes there is a self-dependency?
6365 .filterNot { it.toCoordinates() == rootId }
64- .map {
66+ .map { result ->
6567 // Might be from an included build, in which case the coordinates reflect the _requested_ dependency instead of
6668 // the _resolved_ dependency.
67- Pair (it, it .toCoordinates())
69+ Pair (result, result .toCoordinates())
6870 }
6971 // make reproducible output friendly to compare between executions
70- .sortedWith(
71- compareBy<Pair <ResolvedDependencyResult , Coordinates >> { pair -> pair.second.javaClass.simpleName }
72- .thenComparing { pair -> pair.second.identifier }
73- )
72+ .sortedWith(comparator)
7473 .forEach { (dependencyResult, depId) ->
7574 // add an edge
7675 graphBuilder.putEdge(rootId, depId)
0 commit comments