-
Notifications
You must be signed in to change notification settings - Fork 58
/
build.gradle
126 lines (109 loc) · 3.76 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
apply plugin: 'groovy'
apply plugin: 'java-gradle-plugin'
apply plugin: 'codenarc'
apply from: "$rootDir/gradle/cdeliveryboy-release.gradle"
apply from: "$rootDir/gradle/report-version-consistency-check.gradle"
apply plugin: "com.github.ben-manes.versions"
buildscript {
repositories {
mavenCentral()
mavenLocal()
maven {
//for Plugin Publish plugin
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'info.solidsoft.gradle:cdeliveryboy:0.8.0'
classpath 'io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0' //override version for more reliable releasing from Travis
classpath 'com.gradle.publish:plugin-publish-plugin:0.16.0'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0'
}
}
sourceCompatibility = 1.8
ext.pitestAggregatorVersion = "1.15.0" //Must be equal to default PIT version in PitestPlugin
repositories {
mavenCentral()
mavenLocal()
}
sourceSets {
funcTest
}
dependencies {
implementation localGroovy()
compileOnly "org.pitest:pitest-aggregator:$pitestAggregatorVersion"
testImplementation('org.spockframework:spock-core:2.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
//for "@Rule TemporaryFolder"
testImplementation('org.spockframework:spock-junit4:2.3-groovy-2.5') {
exclude group: 'org.codehaus.groovy'
}
testImplementation 'net.bytebuddy:byte-buddy:1.14.8' //for Spying in Spock
funcTestImplementation sourceSets.main.output //to make production plugin classes visible in functional tests (it's not in testCompile configuration)
funcTestImplementation sourceSets.test.output
funcTestImplementation configurations.testImplementation
funcTestRuntimeOnly configurations.testRuntimeOnly
funcTestImplementation('com.netflix.nebula:nebula-test:7.10.2') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
}
task funcTest(type: Test) {
description = 'Run the functional tests.'
group = 'Verification'
testClassesDirs = sourceSets.funcTest.output.classesDirs
classpath = sourceSets.funcTest.runtimeClasspath
jvmArgs '-Xmx1g'
}
funcTest.shouldRunAfter test
check.shouldRunAfter funcTest
check.dependsOn funcTestClasses //or more generically: tasks.withType(AbstractCompile)
uploadArchives.dependsOn funcTest, check
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn test, funcTest
}
tasks.withType(Test).configureEach { testTask ->
testTask.configure {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
afterSuite { desc, result ->
if (!desc.parent) {
if (result.testCount == 0) {
throw new IllegalStateException("No tests were found. Failing the build")
}
}
}
}
}
tasks.validateTaskProperties {
enableStricterValidation = true
failOnWarning = true
}
codenarc {
toolVersion = "2.0.0"
}
tasks.register("codenarc") {
configure {
dependsOn tasks.withType(CodeNarc)
}
}
//Workaround on https://github.com/gradle/gradle/issues/12663
tasks.withType(CodeNarc) { codeNarcTask ->
reports {
text.enabled = true
html.enabled = true
}
codeNarcTask.finalizedBy(project.task("print${codeNarcTask.name.capitalize()}") {
onlyIf {
codeNarcTask.state.failure != null
}
doLast {
logger.warn("\n****************************** CODE NARC ******************************")
logger.warn(codeNarcTask.reports.text.destination.text.trim())
logger.warn("****************************** CODE NARC ******************************\n")
}
})
}