refactor of dependency-export plugin to allow for cli argument configuration
This commit is contained in:
@@ -36,14 +36,12 @@ plugins {
|
||||
}
|
||||
```
|
||||
|
||||
You can also enable it globally on your machine just create a `~/.gradle/init.gradle` file with this content
|
||||
You can also enable it globally on your machine, just create a `~/.gradle/init.gradle` file with this content
|
||||
|
||||
```groovy
|
||||
initscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "net.woggioni.plugins:dependency-export:0.1"
|
||||
@@ -82,18 +80,15 @@ renderDependencies {
|
||||
and using Kotlin DSL
|
||||
|
||||
```kotlin
|
||||
import net.woggioni.plugins.ExportDependenciesPluginExtension
|
||||
import net.woggioni.plugins.RenderDependenciesPluginExtension
|
||||
|
||||
configure<ExportDependenciesPluginExtension> {
|
||||
configurationName = "default"
|
||||
outputFile = "dependencies.dot"
|
||||
tasks.named<net.woggioni.gradle.dependency.export.ExportDependencies>("exportDependencies") {
|
||||
configurationName.set("compileClasspath")
|
||||
outputFile.set(project.file("dependencies.dot"))
|
||||
}
|
||||
|
||||
configure<RenderDependenciesPluginExtension> {
|
||||
format = "xlib"
|
||||
outputFile = "renderedDependencies"
|
||||
graphvizExecutable = "graphviz"
|
||||
tasks.named<net.woggioni.gradle.dependency.export.RenderDependencies>("renderDependencies") {
|
||||
format.set("xlib")
|
||||
outputFile.set(project.file("renderedDependencies"))
|
||||
graphvizExecutable.set("graphviz")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -102,24 +97,30 @@ or using its correspondent Gradle's [project properties](https://docs.gradle.org
|
||||
For example to override the output format of the `renderDependencies` task from the CLI:
|
||||
|
||||
```bash
|
||||
gradle -PrenderDependencies.format=svg renderDependencies
|
||||
gradle exportDependencies --configuration=compileClasspath renderDependencies --format=svg
|
||||
```
|
||||
|
||||
### Parameter description
|
||||
|
||||
- `exportDependencies.configurationName` will select the Gradle's configuration
|
||||
(that word you put in the `dependencies` section of your build before `groupId:artifactId:versionId` tuple)
|
||||
that will be represented in the graph
|
||||
- `exportDependencies.outputFile` will specify the location of the generated `.dot` file
|
||||
(note that if a relative path is provided, it will be interpreted as relative to the project's build directory)
|
||||
- `renderDependencies.format` will specify the format of the file generated by Graphviz.
|
||||
#### Attributes of task `net.woggioni.gradle.dependency.export.ExportDependencies`
|
||||
- `configurationName` will select the Gradle's configuration
|
||||
(that word you put in the `dependencies` section of your build before `groupId:artifactId:versionId` tuple)
|
||||
that will be represented in the graph. It can also be specified from CLI using `--configuration`.
|
||||
- `outputFile` will specify the location of the generated `.dot` file
|
||||
(note that if a relative path is provided, it will be interpreted as relative to the project's build directory).
|
||||
It can also be specified from CLI using `--output`.
|
||||
|
||||
#### Attributes of task `net.woggioni.gradle.dependency.export.RenderDependencies`
|
||||
- `format` will specify the format of the file generated by Graphviz.
|
||||
The default output format is `xlib` which, on a linux machine with a GUI, will open
|
||||
a window with an interactive (with zoom and pan) view of your dependencies (this is a special format that
|
||||
will not output any file). Otherwise you can choose between any other output format supported by Graphviz,
|
||||
refer to [its official documentation](https://graphviz.gitlab.io/_pages/doc/info/output.html) for more details.
|
||||
- `renderDependencies.outputFile` will specify the location of the generated file (note that if a
|
||||
relative path is provided, it will be interpreted as relative to the project's build directory)
|
||||
- `renderDependencies.graphvizExecutable` will set the executable that will be launched to invoke
|
||||
It can also be specified from CLI using `--format`.
|
||||
- `outputFile` will specify the location of the generated file (note that if a
|
||||
relative path is provided, it will be interpreted as relative to the project's build directory).
|
||||
It can also be specified from CLI using `--output`.
|
||||
- `graphvizExecutable` will set the executable that will be launched to invoke
|
||||
Graphviz so that, if you have it installed in an exotic location outside of your `PATH` or, for
|
||||
any reason, you renamed it in some way, you can configure it here.
|
||||
|
||||
|
Reference in New Issue
Block a user