Adjust dependency graph printing

This commit is contained in:
Alexandre Archambault 2019-02-13 10:04:54 +01:00
parent bb45ca7f5d
commit 7c5b8479ea
3 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import coursier.core._
import coursier.lmcoursier._
import coursier.sbtcoursier.Keys._
import coursier.sbtcoursiershared.SbtCoursierShared.autoImport._
import coursier.util.Print.Colors
import coursier.util.{Parse, Print}
import sbt.Def
import sbt.Keys._
@ -112,7 +111,11 @@ object DisplayTasks {
val resolutions = coursierResolutionTask(sbtClassifiers, ignoreArtifactErrors).value
val result = new mutable.StringBuilder
for (ResolutionResult(subGraphConfigs, resolution, _) <- resolutions) {
val roots: Seq[Dependency] = resolution.transitiveDependencies.filter(f => f.module == module)
val roots = resolution
.minDependencies
.filter(f => f.module == module)
.toVector
.sortBy(_.toString) // elements already have the same module, there's not much left for sorting
val strToPrint = s"$projectName (configurations ${subGraphConfigs.toVector.sorted.map(_.value).mkString(", ")})" + "\n" +
Print.dependencyTree(
resolution,

View File

@ -1,6 +1,9 @@
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.zookeeper" % "zookeeper" % "3.5.0-alpha"
libraryDependencies += {
sys.props("sbt.log.noformat") = "true" // disables colors in coursierWhatDependsOn output
"org.apache.zookeeper" % "zookeeper" % "3.5.0-alpha"
}
lazy val whatDependsOnCheck = TaskKey[Unit]("whatDependsOnCheck")

View File

@ -1,9 +1,5 @@
dependency-graph (configurations compile, compile-internal, optional, provided, runtime, runtime-internal, test, test-internal)
├─ log4j:log4j:1.2.16
│ ├─ org.apache.zookeeper:zookeeper:3.5.0-alpha log4j:log4j:1.2.16 -> 1.2.17
│ └─ org.slf4j:slf4j-log4j12:1.7.5
│ └─ org.apache.zookeeper:zookeeper:3.5.0-alpha
└─ log4j:log4j:1.2.17
├─ org.apache.zookeeper:zookeeper:3.5.0-alpha log4j:log4j:1.2.16 -> 1.2.17
├─ org.apache.zookeeper:zookeeper:3.5.0-alpha log4j:log4j:1.2.16 -> 1.2.17
└─ org.slf4j:slf4j-log4j12:1.7.5
└─ org.apache.zookeeper:zookeeper:3.5.0-alpha