forked from junit-team/junit5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
degraph.gradle
49 lines (40 loc) · 1.26 KB
/
degraph.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import static de.schauderhaft.degraph.check.JCheck.customClasspath
import static de.schauderhaft.degraph.check.JCheck.violationFree
import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.Matchers.is
import de.schauderhaft.degraph.configuration.NamedPattern
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "de.schauderhaft.degraph:degraph-check:${degraphVersion}"
}
}
task degraph(type: DegraphCheck) {
reportFile = new File(buildDir, "reports/degraph/testResult.graphml")
classpath = sourceSets.main.output
}
check.dependsOn degraph
class DegraphCheck extends DefaultTask {
@InputFiles
FileCollection classpath
@OutputFile
File reportFile
@TaskAction
void runDegraph() {
def graph = customClasspath(classpath.asPath)
.printTo(reportFile.getPath())
.noJars()
.including("org.junit.platform.**")
.including("org.junit.vintage.**")
.including("org.junit.jupiter.**")
.withSlicing("module",
new NamedPattern("org.junit.vintage.engine.**", "junit-vintage-engine"),
new NamedPattern("org.junit.jupiter.api.**", "junit-jupiter-api"),
new NamedPattern("org.junit.jupiter.engine.**", "junit-jupiter-engine"),
"org.junit.platform.(*).**"
)
assertThat(graph, is(violationFree()))
}
}