Skip to content

Commit 726121e

Browse files
committed
Remove duplication by introducing checkstyle-conventions plugin
1 parent 3bc81aa commit 726121e

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
base
3+
checkstyle
4+
}
5+
6+
checkstyle {
7+
toolVersion = requiredVersionFromLibs("checkstyle")
8+
configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle")
9+
}
10+
11+
tasks.check {
12+
dependsOn(tasks.withType<Checkstyle>())
13+
}
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,24 @@
11
plugins {
2-
base
3-
checkstyle
4-
}
5-
6-
checkstyle {
7-
toolVersion = requiredVersionFromLibs("checkstyle")
8-
configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle")
2+
id("junitbuild.checkstyle-conventions")
93
}
104

115
dependencies {
126
checkstyle(dependencyFromLibs("nohttp-checkstyle"))
137
}
148

15-
tasks {
16-
val checkstyleNohttp by registering(Checkstyle::class) {
17-
group = "verification"
18-
description = "Checks for illegal uses of http://"
19-
classpath = files(configurations.checkstyle)
20-
config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleNohttp.xml"))
21-
source = fileTree(layout.projectDirectory) {
22-
exclude(".git/**", "**/.gradle/**")
23-
exclude(".idea/**", ".eclipse/**")
24-
exclude("**/*.class")
25-
exclude("**/*.hprof")
26-
exclude("**/*.jar")
27-
exclude("**/*.jpg", "**/*.png")
28-
exclude("**/*.jks")
29-
exclude("**/build/**")
30-
}
31-
}
32-
check {
33-
dependsOn(checkstyleNohttp)
9+
tasks.register<Checkstyle>("checkstyleNohttp") {
10+
group = "verification"
11+
description = "Checks for illegal uses of http://"
12+
classpath = files(configurations.checkstyle)
13+
config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleNohttp.xml"))
14+
source = fileTree(layout.projectDirectory) {
15+
exclude(".git/**", "**/.gradle/**")
16+
exclude(".idea/**", ".eclipse/**")
17+
exclude("**/*.class")
18+
exclude("**/*.hprof")
19+
exclude("**/*.jar")
20+
exclude("**/*.jpg", "**/*.png")
21+
exclude("**/*.jks")
22+
exclude("**/build/**")
3423
}
3524
}

gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ plugins {
1010
`java-library`
1111
eclipse
1212
idea
13-
checkstyle
1413
id("junitbuild.base-conventions")
1514
id("junitbuild.build-parameters")
15+
id("junitbuild.checkstyle-conventions")
1616
id("junitbuild.jacoco-java-conventions")
1717
}
1818

0 commit comments

Comments
 (0)