forked from junit-team/junit5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
306 lines (248 loc) · 7.45 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
buildscript {
repositories {
// mavenLocal()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
classpath 'com.diffplug.gradle.spotless:spotless:1.3.3'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'org.ajoberstar:gradle-git:1.3.2'
classpath 'org.junit:junit-gradle:5.0.0-SNAPSHOT'
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: 'checkstyle'
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.compilerArgs += '-parameters'
}
checkstyle {
toolVersion = 6.11
configFile = rootProject.file('src/checkstyle/checkstyle.xml')
sourceSets = [ sourceSets.main ]
}
spotless {
java {
licenseHeaderFile rootProject.file('src/spotless/eclipse-public-license-1.0.java')
importOrder(['java', 'javax', 'com', 'org'])
eclipseFormatFile rootProject.file('src/eclipse/junit-eclipse-formatter-settings.xml')
trimTrailingWhitespace()
// endWithNewline()
custom 'Lambda fix', { it.replace('} )', '})').replace('} ,', '},') }
}
format 'groovy', {
target '**/*.groovy'
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
licenseHeaderFile rootProject.file('src/spotless/eclipse-public-license-1.0.java'), "package "
customReplaceRegex 'class-level Javadoc indentation fix', /^\*/, ' *'
customReplaceRegex 'nested Javadoc indentation fix', /\t\*/, '\t *'
}
}
if (project.hasProperty('enableClover')) {
configurations {
clover
}
dependencies {
clover 'com.atlassian.clover:clover:4.1.1'
}
ext.cloverDir = file("$buildDir/clover")
ext.cloverInitstring = "$cloverDir/clover.db"
def instrumentedSourcesDir = file("$cloverDir/instrumentedSources")
task cloverTaskdef {
def cloverLicensePath = project.hasProperty('clover.license.path')
? project.property('clover.license.path') : rootProject.file('clover.license').absolutePath
ant.taskdef(resource:'cloverlib.xml', classpath: configurations.clover.asPath)
ant.property(name: 'clover.license.path', value: cloverLicensePath)
}
task cloverInstrument(dependsOn: cloverTaskdef) {
outputs.dir cloverDir
onlyIf { sourceSets.main.allJava.any { it.exists() } }
doLast {
ant.'clover-instr'(
initstring: cloverInitstring,
recordTestResults: false,
destdir: instrumentedSourcesDir,
source: compileJava.sourceCompatibility) {
sourceSets.main.allJava.addToAntBuilder(ant, 'fileset', FileCollection.AntType.FileSet)
}
}
}
compileJava.source = instrumentedSourcesDir
sourceSets.main.compileClasspath += configurations.clover
sourceSets.test.runtimeClasspath += configurations.clover
compileJava.dependsOn cloverInstrument
}
}
subprojects {
apply plugin: 'maven'
apply plugin: 'signing'
javadoc {
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = project.name
options.addStringOption('Xdoclint:html,syntax,reference', '-quiet')
exclude '**/com/example/**'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
artifacts {
archives sourcesJar
archives javadocJar
}
def signArtifacts = !project.version.contains('SNAPSHOT')
afterEvaluate {
if (signArtifacts && uploadArchives.enabled) {
signing {
sign configurations.archives
}
}
}
uploadArchives {
dependsOn check
repositories {
mavenDeployer {
if (signArtifacts) {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
}
def ossrhUsername = rootProject.hasProperty('ossrhUsername') ? rootProject.ossrhUsername : ''
def ossrhPassword = rootProject.hasProperty('ossrhPassword') ? rootProject.ossrhPassword : ''
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name "${project.group}:${project.name}"
packaging 'jar'
description "Module \"${project.name}\" of JUnit 5."
url 'http://junit.org/junit-lambda.html'
scm {
connection 'scm:git:git://github.com/junit-team/junit5.git'
developerConnection 'scm:git:git://github.com/junit-team/junit5.git'
url 'https://github.com/junit-team/junit5'
}
licenses {
license {
name 'Eclipse Public License v1.0'
url 'http://www.eclipse.org/legal/epl-v10.html'
}
}
developers {
developer {
id 'bechte'
name 'Stefan Bechtold'
email '[email protected]'
}
developer {
id 'jlink'
name 'Johannes Link'
email '[email protected]'
}
developer {
id 'marcphilipp'
name 'Marc Philipp'
email '[email protected]'
}
developer {
id 'mmerdes'
name 'Matthias Merdes'
email '[email protected]'
}
developer {
id 'sbrannen'
name 'Sam Brannen'
email '[email protected]'
}
}
}
}
}
}
}
configure(rootProject) {
description = 'JUnit 5'
apply plugin: 'org.junit.gen5.gradle'
jar.enabled = false
uploadArchives.enabled = false
dependencies {
// No need to detect cycles for: junit-tests, sample-project, documentation, surefire-junit5
rootProject.subprojects.findAll {it.name.startsWith('junit') && it.name != 'junit-tests'}.each { project ->
testCompile(project)
}
testCompile("de.schauderhaft.degraph:degraph-check:${degraphVersion}")
testRuntime("org.apache.logging.log4j:log4j-core:${log4JVersion}")
testRuntime("org.apache.logging.log4j:log4j-jul:${log4JVersion}")
}
test {
description = 'Disabled.'
useJUnit()
scanForTestClasses = false
exclude('**/*') // exclude everything
}
junit5 {
logManager 'org.apache.logging.log4j.jul.LogManager'
}
task aggregateJavadocs(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadocs"
title = "JUnit ${version} API"
dependsOn {
subprojects.collect {
it.tasks.getByName("jar")
}
}
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.splitIndex = true
options.addStringOption('Xdoclint:none', '-quiet')
exclude '**/com/example/**'
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
maxMemory = "1024m"
destinationDir = new File(buildDir, "docs/javadoc")
doFirst {
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
}
}
spotless {
format 'misc', {
target '**/*.gradle', '**/*.gitignore'
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
format 'documentation', {
target '**/*.adoc', '**/*.md'
trimTrailingWhitespace()
endWithNewline()
}
}
task wrapper(type: Wrapper) {
distributionUrl = 'https://services.gradle.org/distributions/gradle-2.12-all.zip'
}
}