-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail early and give tailored message when dot command is not present.
- Loading branch information
1 parent
3f05f44
commit 40742ba
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...test/java/com/vanniktech/dependency/graph/generator/DependencyGraphGeneratorPluginTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.vanniktech.dependency.graph.generator | ||
|
||
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator.Companion.ALL | ||
import org.assertj.core.api.Java6Assertions.assertThat | ||
import org.gradle.api.internal.project.DefaultProject | ||
import org.gradle.api.plugins.JavaLibraryPlugin | ||
import org.gradle.testfixtures.ProjectBuilder | ||
import org.junit.Before | ||
import org.junit.Test | ||
import java.io.File | ||
|
||
class DependencyGraphGeneratorPluginTest { | ||
private lateinit var singleProject: DefaultProject | ||
|
||
@Before fun setUp() { | ||
// Casting this to DefaultProject so we can call evaluate later. | ||
singleProject = ProjectBuilder.builder().withName("single").build() as DefaultProject | ||
singleProject.plugins.apply(JavaLibraryPlugin::class.java) | ||
singleProject.repositories.run { add(mavenCentral()) } | ||
singleProject.dependencies.add("api", "org.jetbrains.kotlin:kotlin-stdlib:1.2.30") | ||
singleProject.dependencies.add("implementation", "io.reactivex.rxjava2:rxjava:2.1.10") | ||
} | ||
|
||
@Test fun taskProperties() { | ||
singleProject.plugins.apply(DependencyGraphGeneratorPlugin::class.java) | ||
|
||
singleProject.evaluate() // Need to call this for afterEvaluate() to pick up. | ||
|
||
val task = singleProject.tasks.getByName("generateDependencyGraph") as DependencyGraphGeneratorTask | ||
assertThat(task.generator).isSameAs(ALL) | ||
assertThat(task.group).isEqualTo("reporting") | ||
assertThat(task.description).isEqualTo("Generates a dependency graph") | ||
assertThat(task.inputFile).hasToString(singleProject.buildFile.toString()) | ||
assertThat(task.dotOutputFile).hasToString(File(singleProject.buildDir, "dependency-graph.dot").toString()) | ||
assertThat(task.imageOutputFile).hasToString(File(singleProject.projectDir, "dependency-graph.png").toString()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters