mirror of https://github.com/sbt/sbt.git
add `dependency-list`, fixes #85
This commit is contained in:
parent
00d64878aa
commit
f7e3a49e93
|
|
@ -25,6 +25,7 @@ This plugin is an auto-plugin which will be automatically enabled starting from
|
||||||
* `dependencyTree`: Shows an ASCII tree representation of the project's dependencies
|
* `dependencyTree`: Shows an ASCII tree representation of the project's dependencies
|
||||||
* `dependencyBrowseGraph`: Opens a browser window with a visualization of the dependency graph (courtesy of graphlib-dot + dagre-d3).
|
* `dependencyBrowseGraph`: Opens a browser window with a visualization of the dependency graph (courtesy of graphlib-dot + dagre-d3).
|
||||||
* `dependencyGraph`: Shows an ASCII graph of the project's dependencies on the sbt console
|
* `dependencyGraph`: Shows an ASCII graph of the project's dependencies on the sbt console
|
||||||
|
* `dependencyList`: Shows a flat list of all transitive dependencies on the sbt console (sorted by organization and name)
|
||||||
* `whatDependsOn <organization> <module> <revision>`: Find out what depends on an artifact. Shows a reverse dependency
|
* `whatDependsOn <organization> <module> <revision>`: Find out what depends on an artifact. Shows a reverse dependency
|
||||||
tree for the selected module.
|
tree for the selected module.
|
||||||
* `dependencyLicenseInfo`: show dependencies grouped by declared license
|
* `dependencyLicenseInfo`: show dependencies grouped by declared license
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@ trait DependencyGraphKeys {
|
||||||
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 the ascii tree to the console")
|
"Prints an ascii tree of all the dependencies to the console")
|
||||||
|
val dependencyList = TaskKey[Unit]("dependency-list",
|
||||||
|
"Prints a list of 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",
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,7 @@ object DependencyGraphSettings {
|
||||||
java.awt.Desktop.getDesktop.browse(uri)
|
java.awt.Desktop.getDesktop.browse(uri)
|
||||||
uri
|
uri
|
||||||
},
|
},
|
||||||
|
dependencyList <<= (moduleGraph, streams).map((graph, streams) ⇒ streams.log.info(rendering.FlatList.render(graph, _.id.idString))),
|
||||||
dependencyDotHeader := """digraph "dependency-graph" {
|
dependencyDotHeader := """digraph "dependency-graph" {
|
||||||
| graph[rankdir="LR"]
|
| graph[rankdir="LR"]
|
||||||
| edge [
|
| edge [
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2016 Johannes Rudolph
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.virtualvoid.sbt.graph
|
||||||
|
package rendering
|
||||||
|
|
||||||
|
object FlatList {
|
||||||
|
def render(graph: ModuleGraph, display: Module ⇒ String): String =
|
||||||
|
graph.modules.values.toSeq
|
||||||
|
.distinct
|
||||||
|
.filterNot(_.isEvicted)
|
||||||
|
.sortBy(m ⇒ (m.id.organisation, m.id.name))
|
||||||
|
.map(display)
|
||||||
|
.mkString("\n")
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue