mirror of https://github.com/sbt/sbt.git
Merge pull request #154 from jrudolph/modernize-build
Update to sbt 1.1.6
This commit is contained in:
commit
e597bcf804
10
build.sbt
10
build.sbt
|
|
@ -1,8 +1,6 @@
|
||||||
ScriptedPlugin.scriptedSettings
|
scriptedLaunchOpts += s"-Dproject.version=${version.value}"
|
||||||
ScriptedPlugin.scriptedLaunchOpts += s"-Dproject.version=${version.value}"
|
|
||||||
|
|
||||||
libraryDependencies ++= {
|
libraryDependencies ++= {
|
||||||
println(s"Evaluated ${sbtVersion in pluginCrossBuild value}")
|
|
||||||
if ((sbtVersion in pluginCrossBuild).value startsWith "0.13")
|
if ((sbtVersion in pluginCrossBuild).value startsWith "0.13")
|
||||||
Seq("com.github.mdr" %% "ascii-graphs" % "0.0.3")
|
Seq("com.github.mdr" %% "ascii-graphs" % "0.0.3")
|
||||||
else
|
else
|
||||||
|
|
@ -10,15 +8,15 @@ libraryDependencies ++= {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
libraryDependencies += "org.specs2" %% "specs2-core" % "3.9.5" % Test
|
libraryDependencies += "org.specs2" %% "specs2-core" % "3.10.0" % Test
|
||||||
|
|
||||||
libraryDependencies += Defaults.sbtPluginExtra(
|
libraryDependencies += Defaults.sbtPluginExtra(
|
||||||
"com.dwijnand" % "sbt-compat" % "1.1.0",
|
"com.dwijnand" % "sbt-compat" % "1.2.6",
|
||||||
(sbtBinaryVersion in pluginCrossBuild).value,
|
(sbtBinaryVersion in pluginCrossBuild).value,
|
||||||
(scalaBinaryVersion in update).value
|
(scalaBinaryVersion in update).value
|
||||||
)
|
)
|
||||||
|
|
||||||
crossSbtVersions := Seq("1.0.2", "0.13.16")
|
crossSbtVersions := Seq("1.1.6", "0.13.16")
|
||||||
|
|
||||||
scalacOptions ++= Seq(
|
scalacOptions ++= Seq(
|
||||||
"-deprecation",
|
"-deprecation",
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
sbt.version=0.13.16
|
sbt.version=1.1.6
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
|
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
|
||||||
|
|
||||||
addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.2.1")
|
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
|
||||||
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "2.0.0")
|
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "2.0.0")
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,5 @@ object AsciiGraph {
|
||||||
log.info("\n")
|
log.info("\n")
|
||||||
log.info("Note: The graph was estimated to be too big to display (> 15 nodes). Use `sbt 'dependency-graph --force'` (with the single quotes) to force graph display.")
|
log.info("Note: The graph was estimated to be too big to display (> 15 nodes). Use `sbt 'dependency-graph --force'` (with the single quotes) to force graph display.")
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ object DependencyGraphSbtCompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is copied directly from https://github.com/sbt/sbt/blob/2952a2b9b672c5402b824ad2d2076243eb643598/main/src/main/scala/sbt/Defaults.scala#L1471-L1523
|
* This is copied directly from https://github.com/sbt/sbt/blob/2952a2b9b672c5402b824ad2d2076243eb643598/main/src/main/scala/sbt/Defaults.scala#L1471-L1523
|
||||||
* and then changed to update the UpdateConfiguration to ignore missing artifacts.
|
* and then changed to update the UpdateConfiguration to ignore missing artifacts.
|
||||||
*/
|
*/
|
||||||
def updateTask(task: TaskKey[_]): Initialize[Task[UpdateReport]] = Def.task {
|
def updateTask(task: TaskKey[_]): Initialize[Task[UpdateReport]] = Def.task {
|
||||||
val depsUpdated = transitiveUpdate.value.exists(!_.stats.cached)
|
val depsUpdated = transitiveUpdate.value.exists(!_.stats.cached)
|
||||||
val isRoot = executionRoots.value contains resolvedScoped.value
|
val isRoot = executionRoots.value contains resolvedScoped.value
|
||||||
|
|
@ -32,8 +32,8 @@ object DependencyGraphSbtCompat {
|
||||||
val s = streams.value
|
val s = streams.value
|
||||||
val fullUpdateOutput = s.cacheDirectory / "out"
|
val fullUpdateOutput = s.cacheDirectory / "out"
|
||||||
val forceUpdateByTime = forceUpdate match {
|
val forceUpdateByTime = forceUpdate match {
|
||||||
case None => false
|
case None ⇒ false
|
||||||
case Some(period) =>
|
case Some(period) ⇒
|
||||||
val elapsedDuration = new FiniteDuration(System.currentTimeMillis() - fullUpdateOutput.lastModified(), TimeUnit.MILLISECONDS)
|
val elapsedDuration = new FiniteDuration(System.currentTimeMillis() - fullUpdateOutput.lastModified(), TimeUnit.MILLISECONDS)
|
||||||
fullUpdateOutput.exists() && elapsedDuration > period
|
fullUpdateOutput.exists() && elapsedDuration > period
|
||||||
}
|
}
|
||||||
|
|
@ -42,17 +42,17 @@ object DependencyGraphSbtCompat {
|
||||||
// Only substitute unmanaged jars for managed jars when the major.minor parts of the versions the same for:
|
// Only substitute unmanaged jars for managed jars when the major.minor parts of the versions the same for:
|
||||||
// the resolved Scala version and the scalaHome version: compatible (weakly- no qualifier checked)
|
// the resolved Scala version and the scalaHome version: compatible (weakly- no qualifier checked)
|
||||||
// the resolved Scala version and the declared scalaVersion: assume the user intended scalaHome to override anything with scalaVersion
|
// the resolved Scala version and the declared scalaVersion: assume the user intended scalaHome to override anything with scalaVersion
|
||||||
def subUnmanaged(subVersion: String, jars: Seq[File]) = (sv: String) =>
|
def subUnmanaged(subVersion: String, jars: Seq[File]) = (sv: String) ⇒
|
||||||
(partialVersion(sv), partialVersion(subVersion), partialVersion(scalaVersion.value)) match {
|
(partialVersion(sv), partialVersion(subVersion), partialVersion(scalaVersion.value)) match {
|
||||||
case (Some(res), Some(sh), _) if res == sh => jars
|
case (Some(res), Some(sh), _) if res == sh ⇒ jars
|
||||||
case (Some(res), _, Some(decl)) if res == decl => jars
|
case (Some(res), _, Some(decl)) if res == decl ⇒ jars
|
||||||
case _ => Nil
|
case _ ⇒ Nil
|
||||||
}
|
}
|
||||||
val subScalaJars: String => Seq[File] = Defaults.unmanagedScalaInstanceOnly.value match {
|
val subScalaJars: String ⇒ Seq[File] = Defaults.unmanagedScalaInstanceOnly.value match {
|
||||||
case Some(si) => subUnmanaged(si.version, si.jars)
|
case Some(si) ⇒ subUnmanaged(si.version, si.jars)
|
||||||
case None => sv => if (scalaProvider.version == sv) scalaProvider.jars else Nil
|
case None ⇒ sv ⇒ if (scalaProvider.version == sv) scalaProvider.jars else Nil
|
||||||
}
|
}
|
||||||
val transform: UpdateReport => UpdateReport = r => sbt.Classpaths.substituteScalaFiles(scalaOrganization.value, r)(subScalaJars)
|
val transform: UpdateReport ⇒ UpdateReport = r ⇒ sbt.Classpaths.substituteScalaFiles(scalaOrganization.value, r)(subScalaJars)
|
||||||
val uwConfig = (unresolvedWarningConfiguration in update).value
|
val uwConfig = (unresolvedWarningConfiguration in update).value
|
||||||
val show = Reference.display(thisProjectRef.value)
|
val show = Reference.display(thisProjectRef.value)
|
||||||
val st = state.value
|
val st = state.value
|
||||||
|
|
@ -66,9 +66,9 @@ object DependencyGraphSbtCompat {
|
||||||
// This code bumps up the sbt.UpdateConfiguration.logging to Full when logLevel is Debug.
|
// This code bumps up the sbt.UpdateConfiguration.logging to Full when logLevel is Debug.
|
||||||
import UpdateLogging.{ Full, DownloadOnly, Default }
|
import UpdateLogging.{ Full, DownloadOnly, Default }
|
||||||
val uc = (logLevel in update).?.value orElse st.get(logLevel.key) match {
|
val uc = (logLevel in update).?.value orElse st.get(logLevel.key) match {
|
||||||
case Some(Level.Debug) if uc0.logging == Default => uc0.copy(logging = Full)
|
case Some(Level.Debug) if uc0.logging == Default ⇒ uc0.copy(logging = Full)
|
||||||
case Some(x) if uc0.logging == Default => uc0.copy(logging = DownloadOnly)
|
case Some(x) if uc0.logging == Default ⇒ uc0.copy(logging = DownloadOnly)
|
||||||
case _ => uc0
|
case _ ⇒ uc0
|
||||||
}
|
}
|
||||||
val ewo =
|
val ewo =
|
||||||
if (executionRoots.value exists { _.key == evicted.key }) EvictionWarningOptions.empty
|
if (executionRoots.value exists { _.key == evicted.key }) EvictionWarningOptions.empty
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ object DependencyGraphSbtCompat {
|
||||||
ewo = evictionOptions,
|
ewo = evictionOptions,
|
||||||
mavenStyle = publishMavenStyle.value,
|
mavenStyle = publishMavenStyle.value,
|
||||||
compatWarning = compatibilityWarningOptions.value,
|
compatWarning = compatibilityWarningOptions.value,
|
||||||
log = s.log
|
log = s.log)
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,53 +19,76 @@ package net.virtualvoid.sbt.graph
|
||||||
import sbt._
|
import sbt._
|
||||||
|
|
||||||
trait DependencyGraphKeys {
|
trait DependencyGraphKeys {
|
||||||
val dependencyGraphMLFile = SettingKey[File]("dependency-graph-ml-file",
|
val dependencyGraphMLFile = SettingKey[File](
|
||||||
|
"dependency-graph-ml-file",
|
||||||
"The location the graphml file should be generated at")
|
"The location the graphml file should be generated at")
|
||||||
val dependencyGraphML = TaskKey[File]("dependency-graph-ml",
|
val dependencyGraphML = TaskKey[File](
|
||||||
|
"dependency-graph-ml",
|
||||||
"Creates a graphml file containing the dependency-graph for a project")
|
"Creates a graphml file containing the dependency-graph for a project")
|
||||||
val dependencyDotFile = SettingKey[File]("dependency-dot-file",
|
val dependencyDotFile = SettingKey[File](
|
||||||
|
"dependency-dot-file",
|
||||||
"The location the dot file should be generated at")
|
"The location the dot file should be generated at")
|
||||||
val dependencyDotNodeLabel = SettingKey[(String, String, String) ⇒ String]("dependency-dot-node-label",
|
val dependencyDotNodeLabel = SettingKey[(String, String, String) ⇒ String](
|
||||||
|
"dependency-dot-node-label",
|
||||||
"Returns a formated string of a dependency. Takes organisation, name and version as parameters")
|
"Returns a formated string of a dependency. Takes organisation, name and version as parameters")
|
||||||
val dependencyDotHeader = SettingKey[String]("dependency-dot-header",
|
val dependencyDotHeader = SettingKey[String](
|
||||||
|
"dependency-dot-header",
|
||||||
"The header of the dot file. (e.g. to set your preferred node shapes)")
|
"The header of the dot file. (e.g. to set your preferred node shapes)")
|
||||||
val dependencyDot = TaskKey[File]("dependency-dot",
|
val dependencyDot = TaskKey[File](
|
||||||
|
"dependency-dot",
|
||||||
"Creates a dot file containing the dependency-graph for a project")
|
"Creates a dot file containing the dependency-graph for a project")
|
||||||
val dependencyDotString = TaskKey[String]("dependency-dot-string",
|
val dependencyDotString = TaskKey[String](
|
||||||
|
"dependency-dot-string",
|
||||||
"Creates a String containing the dependency-graph for a project in dot format")
|
"Creates a String containing the dependency-graph for a project in dot format")
|
||||||
val dependencyBrowseGraphTarget = SettingKey[File]("dependency-browse-graph-target",
|
val dependencyBrowseGraphTarget = SettingKey[File](
|
||||||
|
"dependency-browse-graph-target",
|
||||||
"The location dependency browse graph files should be put.")
|
"The location dependency browse graph files should be put.")
|
||||||
val dependencyBrowseGraphHTML = TaskKey[URI]("dependency-browse-graph-html",
|
val dependencyBrowseGraphHTML = TaskKey[URI](
|
||||||
|
"dependency-browse-graph-html",
|
||||||
"Creates an HTML page that can be used to view the graph.")
|
"Creates an HTML page that can be used to view the graph.")
|
||||||
val dependencyBrowseGraph = TaskKey[URI]("dependency-browse-graph",
|
val dependencyBrowseGraph = TaskKey[URI](
|
||||||
|
"dependency-browse-graph",
|
||||||
"Opens an HTML page that can be used to view the graph.")
|
"Opens an HTML page that can be used to view the graph.")
|
||||||
val moduleGraph = TaskKey[ModuleGraph]("module-graph",
|
val moduleGraph = TaskKey[ModuleGraph](
|
||||||
|
"module-graph",
|
||||||
"The dependency graph for a project")
|
"The dependency graph for a project")
|
||||||
val moduleGraphIvyReport = TaskKey[ModuleGraph]("module-graph-ivy-report",
|
val moduleGraphIvyReport = TaskKey[ModuleGraph](
|
||||||
|
"module-graph-ivy-report",
|
||||||
"The dependency graph for a project as generated from an Ivy Report XML")
|
"The dependency graph for a project as generated from an Ivy Report XML")
|
||||||
val moduleGraphSbt = TaskKey[ModuleGraph]("module-graph-sbt",
|
val moduleGraphSbt = TaskKey[ModuleGraph](
|
||||||
|
"module-graph-sbt",
|
||||||
"The dependency graph for a project as generated from SBT data structures.")
|
"The dependency graph for a project as generated from SBT data structures.")
|
||||||
val asciiGraph = TaskKey[String]("dependency-graph-string",
|
val asciiGraph = TaskKey[String](
|
||||||
|
"dependency-graph-string",
|
||||||
"Returns a string containing the ascii representation of the dependency graph for a project")
|
"Returns a string containing the ascii representation of the dependency graph for a project")
|
||||||
val dependencyGraph = InputKey[Unit]("dependency-graph",
|
val dependencyGraph = InputKey[Unit](
|
||||||
|
"dependency-graph",
|
||||||
"Prints the ascii graph to the console")
|
"Prints the ascii graph to the console")
|
||||||
val asciiTree = TaskKey[String]("dependency-tree-string",
|
val asciiTree = TaskKey[String](
|
||||||
|
"dependency-tree-string",
|
||||||
"Returns a string containing an ascii tree representation of the dependency graph for a project")
|
"Returns a string containing an ascii tree representation of the dependency graph for a project")
|
||||||
val dependencyTree = TaskKey[Unit]("dependency-tree",
|
val dependencyTree = TaskKey[Unit](
|
||||||
|
"dependency-tree",
|
||||||
"Prints an ascii tree of all the dependencies to the console")
|
"Prints an ascii tree of all the dependencies to the console")
|
||||||
val dependencyList = TaskKey[Unit]("dependency-list",
|
val dependencyList = TaskKey[Unit](
|
||||||
|
"dependency-list",
|
||||||
"Prints a list of all dependencies to the console")
|
"Prints a list of all dependencies to the console")
|
||||||
val dependencyStats = TaskKey[Unit]("dependency-stats",
|
val dependencyStats = TaskKey[Unit](
|
||||||
|
"dependency-stats",
|
||||||
"Prints statistics for all dependencies to the console")
|
"Prints statistics for all dependencies to the console")
|
||||||
val ivyReportFunction = TaskKey[String ⇒ File]("ivy-report-function",
|
val ivyReportFunction = TaskKey[String ⇒ File](
|
||||||
|
"ivy-report-function",
|
||||||
"A function which returns the file containing the ivy report from the ivy cache for a given configuration")
|
"A function which returns the file containing the ivy report from the ivy cache for a given configuration")
|
||||||
val ivyReport = TaskKey[File]("ivy-report",
|
val ivyReport = TaskKey[File](
|
||||||
|
"ivy-report",
|
||||||
"A task which returns the location of the ivy report file for a given configuration (default `compile`).")
|
"A task which returns the location of the ivy report file for a given configuration (default `compile`).")
|
||||||
val ignoreMissingUpdate = Keys.update in ivyReport
|
val ignoreMissingUpdate = Keys.update in ivyReport
|
||||||
val filterScalaLibrary = SettingKey[Boolean]("filter-scala-library",
|
val filterScalaLibrary = SettingKey[Boolean](
|
||||||
|
"filter-scala-library",
|
||||||
"Specifies if scala dependency should be filtered in dependency-* output")
|
"Specifies if scala dependency should be filtered in dependency-* output")
|
||||||
|
|
||||||
val licenseInfo = TaskKey[Unit]("dependency-license-info",
|
val licenseInfo = TaskKey[Unit](
|
||||||
|
"dependency-license-info",
|
||||||
"Aggregates and shows information about the licenses of dependencies")
|
"Aggregates and shows information about the licenses of dependencies")
|
||||||
|
|
||||||
// internal
|
// internal
|
||||||
|
|
|
||||||
|
|
@ -160,20 +160,19 @@ object DependencyGraphSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
val artifactIdParser: Def.Initialize[State ⇒ Parser[ModuleId]] =
|
val artifactIdParser: Def.Initialize[State ⇒ Parser[ModuleId]] =
|
||||||
resolvedScoped { ctx ⇒
|
resolvedScoped { ctx ⇒ (state: State) ⇒
|
||||||
(state: State) ⇒
|
val graph = loadFromContext(moduleGraphStore, ctx, state) getOrElse ModuleGraph(Nil, Nil)
|
||||||
val graph = loadFromContext(moduleGraphStore, ctx, state) getOrElse ModuleGraph(Nil, Nil)
|
|
||||||
|
|
||||||
import sbt.complete.DefaultParsers._
|
import sbt.complete.DefaultParsers._
|
||||||
graph.nodes.map(_.id).map {
|
graph.nodes.map(_.id).map {
|
||||||
case id @ ModuleId(org, name, version) ⇒
|
case id @ ModuleId(org, name, version) ⇒
|
||||||
(Space ~ token(org) ~ token(Space ~ name) ~ token(Space ~ version)).map(_ ⇒ id)
|
(Space ~ token(org) ~ token(Space ~ name) ~ token(Space ~ version)).map(_ ⇒ id)
|
||||||
}.reduceOption(_ | _).getOrElse {
|
}.reduceOption(_ | _).getOrElse {
|
||||||
(Space ~> token(StringBasic, "organization") ~ Space ~ token(StringBasic, "module") ~ Space ~ token(StringBasic, "version")).map {
|
(Space ~> token(StringBasic, "organization") ~ Space ~ token(StringBasic, "module") ~ Space ~ token(StringBasic, "version")).map {
|
||||||
case ((((org, _), mod), _), version) ⇒
|
case ((((org, _), mod), _), version) ⇒
|
||||||
ModuleId(org, mod, version)
|
ModuleId(org, mod, version)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is to support 0.13.8's InlineConfigurationWithExcludes while not forcing 0.13.8
|
// This is to support 0.13.8's InlineConfigurationWithExcludes while not forcing 0.13.8
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ object IvyReport {
|
||||||
revision ← mod \ "revision"
|
revision ← mod \ "revision"
|
||||||
rev = revision.attribute("name").get.text
|
rev = revision.attribute("name").get.text
|
||||||
moduleId = moduleIdFromElement(mod, rev)
|
moduleId = moduleIdFromElement(mod, rev)
|
||||||
module = Module(moduleId,
|
module = Module(
|
||||||
|
moduleId,
|
||||||
(revision \ "license").headOption.flatMap(_.attribute("name")).map(_.text),
|
(revision \ "license").headOption.flatMap(_.attribute("name")).map(_.text),
|
||||||
evictedByVersion = (revision \ "evicted-by").headOption.flatMap(_.attribute("rev").map(_.text)),
|
evictedByVersion = (revision \ "evicted-by").headOption.flatMap(_.attribute("rev").map(_.text)),
|
||||||
error = revision.attribute("error").map(_.text))
|
error = revision.attribute("error").map(_.text))
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ object SbtUpdateReport {
|
||||||
def moduleEdge(chosenVersion: Option[String])(report: ModuleReport): (Module, Seq[Edge]) = {
|
def moduleEdge(chosenVersion: Option[String])(report: ModuleReport): (Module, Seq[Edge]) = {
|
||||||
val evictedByVersion = if (report.evicted) chosenVersion else None
|
val evictedByVersion = if (report.evicted) chosenVersion else None
|
||||||
val jarFile = report.artifacts.find(_._1.`type` == "jar").orElse(report.artifacts.find(_._1.extension == "jar")).map(_._2)
|
val jarFile = report.artifacts.find(_._1.`type` == "jar").orElse(report.artifacts.find(_._1.extension == "jar")).map(_._2)
|
||||||
(Module(
|
(
|
||||||
|
Module(
|
||||||
id = report.module,
|
id = report.module,
|
||||||
license = report.licenses.headOption.map(_._1),
|
license = report.licenses.headOption.map(_._1),
|
||||||
evictedByVersion = evictedByVersion,
|
evictedByVersion = evictedByVersion,
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,19 @@ import sbinary.Format
|
||||||
|
|
||||||
import scala.collection.mutable.{ HashMap, MultiMap, Set }
|
import scala.collection.mutable.{ HashMap, MultiMap, Set }
|
||||||
|
|
||||||
case class ModuleId(organisation: String,
|
case class ModuleId(
|
||||||
name: String,
|
organisation: String,
|
||||||
version: String) {
|
name: String,
|
||||||
|
version: String) {
|
||||||
def idString: String = organisation + ":" + name + ":" + version
|
def idString: String = organisation + ":" + name + ":" + version
|
||||||
}
|
}
|
||||||
case class Module(id: ModuleId,
|
case class Module(
|
||||||
license: Option[String] = None,
|
id: ModuleId,
|
||||||
extraInfo: String = "",
|
license: Option[String] = None,
|
||||||
evictedByVersion: Option[String] = None,
|
extraInfo: String = "",
|
||||||
jarFile: Option[File] = None,
|
evictedByVersion: Option[String] = None,
|
||||||
error: Option[String] = None) {
|
jarFile: Option[File] = None,
|
||||||
|
error: Option[String] = None) {
|
||||||
def hadError: Boolean = error.isDefined
|
def hadError: Boolean = error.isDefined
|
||||||
def isUsed: Boolean = !isEvicted
|
def isUsed: Boolean = !isEvicted
|
||||||
def isEvicted: Boolean = evictedByVersion.isDefined
|
def isEvicted: Boolean = evictedByVersion.isDefined
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,17 @@ package rendering
|
||||||
object DOT {
|
object DOT {
|
||||||
val EvictedStyle = "stroke-dasharray: 5,5"
|
val EvictedStyle = "stroke-dasharray: 5,5"
|
||||||
|
|
||||||
def dotGraph(graph: ModuleGraph,
|
def dotGraph(
|
||||||
dotHead: String,
|
graph: ModuleGraph,
|
||||||
nodeFormation: (String, String, String) ⇒ String,
|
dotHead: String,
|
||||||
labelRendering: HTMLLabelRendering): String = {
|
nodeFormation: (String, String, String) ⇒ String,
|
||||||
|
labelRendering: HTMLLabelRendering): String = {
|
||||||
val nodes = {
|
val nodes = {
|
||||||
for (n ← graph.nodes) yield {
|
for (n ← graph.nodes) yield {
|
||||||
val style = if (n.isEvicted) EvictedStyle else ""
|
val style = if (n.isEvicted) EvictedStyle else ""
|
||||||
val label = nodeFormation(n.id.organisation, n.id.name, n.id.version)
|
val label = nodeFormation(n.id.organisation, n.id.name, n.id.version)
|
||||||
""" "%s"[%s style="%s"]""".format(n.id.idString,
|
""" "%s"[%s style="%s"]""".format(
|
||||||
|
n.id.idString,
|
||||||
labelRendering.renderLabel(label),
|
labelRendering.renderLabel(label),
|
||||||
style)
|
style)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,12 +20,12 @@ package rendering
|
||||||
object Statistics {
|
object Statistics {
|
||||||
def renderModuleStatsList(graph: ModuleGraph): String = {
|
def renderModuleStatsList(graph: ModuleGraph): String = {
|
||||||
case class ModuleStats(
|
case class ModuleStats(
|
||||||
id: ModuleId,
|
id: ModuleId,
|
||||||
numDirectDependencies: Int,
|
numDirectDependencies: Int,
|
||||||
numTransitiveDependencies: Int,
|
numTransitiveDependencies: Int,
|
||||||
selfSize: Option[Long],
|
selfSize: Option[Long],
|
||||||
transitiveSize: Long,
|
transitiveSize: Long,
|
||||||
transitiveDependencyStats: Map[ModuleId, ModuleStats]) {
|
transitiveDependencyStats: Map[ModuleId, ModuleStats]) {
|
||||||
def transitiveStatsWithSelf: Map[ModuleId, ModuleStats] = transitiveDependencyStats + (id -> this)
|
def transitiveStatsWithSelf: Map[ModuleId, ModuleStats] = transitiveDependencyStats + (id -> this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,11 @@ object AsciiTreeLayout {
|
||||||
// [info] | +-baz
|
// [info] | +-baz
|
||||||
// [info] |
|
// [info] |
|
||||||
// [info] +-quux
|
// [info] +-quux
|
||||||
def toAscii[A](top: A,
|
def toAscii[A](
|
||||||
children: A ⇒ Seq[A],
|
top: A,
|
||||||
display: A ⇒ String,
|
children: A ⇒ Seq[A],
|
||||||
maxColumn: Int = defaultColumnSize): String = {
|
display: A ⇒ String,
|
||||||
|
maxColumn: Int = defaultColumnSize): String = {
|
||||||
val twoSpaces = " " + " " // prevent accidentally being converted into a tab
|
val twoSpaces = " " + " " // prevent accidentally being converted into a tab
|
||||||
def limitLine(s: String): String =
|
def limitLine(s: String): String =
|
||||||
if (s.length > maxColumn) s.slice(0, maxColumn - 2) + ".."
|
if (s.length > maxColumn) s.slice(0, maxColumn - 2) + ".."
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ import net.virtualvoid.sbt.graph.DependencyGraphKeys.dependencyDot
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
|
|
||||||
def defaultSettings =
|
def defaultSettings =
|
||||||
Seq(scalaVersion := "2.9.2")
|
Seq(
|
||||||
|
scalaVersion := "2.9.2",
|
||||||
|
version := "0.1-SNAPSHOT"
|
||||||
|
)
|
||||||
|
|
||||||
lazy val justATransiviteDependencyEndpointProject =
|
lazy val justATransiviteDependencyEndpointProject =
|
||||||
Project("just-a-transitive-dependency-endpoint", file("a"))
|
Project("just-a-transitive-dependency-endpoint", file("a"))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue