-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle
170 lines (141 loc) · 3.25 KB
/
build.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}
plugins {
id('checkstyle')
id('jacoco')
id('java-gradle-plugin')
alias(libs.plugins.pluginPublish)
alias(libs.plugins.prettyJupiter)
alias(libs.plugins.strictNullCheck)
alias(libs.plugins.sonarlint)
}
group = 'io.github.joselion'
java {
sourceCompatibility = JavaLanguageVersion.of(17)
toolchain {
languageVersion = JavaLanguageVersion.of(22)
vendor = JvmVendorSpec.ORACLE
}
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
dependencyLocking {
lockAllConfigurations()
}
checkstyle {
setMaxWarnings(0)
setToolVersion(libs.versions.checkstyle.get())
}
sonarLint {
languages {
include('java')
}
rules {
enable(
'java:S4266', // "Stream.collect()" calls should not be redundant
)
disable(
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
'java:S6203', // Allow textbloks in lambda expressions
)
}
}
strictNullCheck {
addEclipse()
packageInfo.useEclipse()
}
repositories {
mavenCentral()
}
dependencies {
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)
sonarlintCorePlugins(libs.sonarlint.java)
implementation(localGroovy())
}
testing {
suites {
configureEach {
useJUnitJupiter(libs.versions.junit.get())
dependencies {
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)
implementation(libs.mockito)
implementation(libs.assertj)
}
}
testkit(JvmTestSuite) {
dependencies {
implementation(gradleTestKit())
}
targets {
all {
testTask.configure {
shouldRunAfter(test)
}
}
}
}
}
}
prettyJupiter {
duration {
customThreshold = [testkit: 1000]
}
}
jacoco {
setToolVersion(libs.versions.jacoco.get())
}
jacocoTestReport {
dependsOn(test, testkit)
reports {
html.required = true
xml.required = true
}
}
gradlePlugin {
website = 'https://joselion.github.io/pretty-jupiter/'
vcsUrl = 'https://github.com/joselion/pretty-jupiter'
plugins {
prettyJupiter {
id = 'io.github.joselion.pretty-jupiter'
implementationClass = 'io.github.joselion.prettyjupiter.PrettyJupiterPlugin'
displayName = 'Pretty Jupiter Plugin'
description = 'Gradle plugin to log JUnit Jupiter tests with a pretty Mocha.js style'
tags.set([
'junit',
'jupiter',
'junit5',
'logger',
'pretty',
'tdd',
'bdd'
])
}
}
testSourceSets.add(sourceSets.testkit)
}
task preparePublish() {
doLast {
def publishKey = findProperty('gradlePublishKey')
def publishSecret = findProperty('gradlePublishSecret')
System.properties.setProperty('gradle.publish.key', publishKey)
System.properties.setProperty('gradle.publish.secret', publishSecret)
}
}
tasks.named('check') {
dependsOn(testing.suites.testkit)
}
tasks.named('publishPlugins') {
dependsOn(tasks.preparePublish)
}