forked from szpak/gradle-pitest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
142 lines (124 loc) · 4.3 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
plugins {
id 'com.github.ben-manes.versions' version '0.51.0'
id 'groovy'
id 'maven-publish'
id 'codenarc'
id 'signing'
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '1.2.1'
id 'com.vanniktech.maven.publish' version '0.25.3'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
ext.pitestAggregatorVersion = "1.15.0" //Must be equal to default PIT version in PitestPlugin
repositories {
mavenCentral()
mavenLocal()
google()
}
sourceSets {
funcTest
}
configurations {
funcTest.extendsFrom(testImplementation, testRuntimeOnly, implementation)
}
dependencies {
implementation localGroovy()
compileOnly "org.pitest:pitest-aggregator:$pitestAggregatorVersion"
implementation 'com.android.tools.build:gradle:8.5.1'
implementation 'com.vdurmont:semver4j:3.1.0'
testImplementation('org.spockframework:spock-core:2.3-groovy-3.0') {
exclude group: 'org.codehaus.groovy'
}
//for "@Rule TemporaryFolder"
testImplementation('org.spockframework:spock-junit4:2.3-groovy-3.0') {
exclude group: 'org.codehaus.groovy'
}
testImplementation 'net.bytebuddy:byte-buddy:1.14.18' //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 'com.vdurmont:semver4j:3.1.0'
funcTestImplementation 'com.android.tools.build:gradle:8.5.1'
funcTestImplementation('com.netflix.nebula:nebula-test:10.6.1') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
}
tasks.register('funcTest', Test) {
description = 'Run the functional tests.'
group = 'Verification'
testClassesDirs = sourceSets.funcTest.output.classesDirs
classpath = sourceSets.funcTest.runtimeClasspath
forkEvery 1
systemProperty('org.gradle.daemon', 'false')
systemProperty('ignoreDeprecations', 'true') //FIXME remove after AGP stops using deprecated API
}
funcTest.shouldRunAfter test
check.shouldRunAfter funcTest
check.dependsOn funcTestClasses //or more generically: tasks.withType(AbstractCompile)
publishPlugins.dependsOn funcTest, check
tasks.register('testReport', 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")
}
}
}
}
}
codenarc {
toolVersion = "3.5.0"
}
tasks.register("codenarc") {
configure {
dependsOn tasks.withType(CodeNarc)
}
}
//Workaround on https://github.com/gradle/gradle/issues/12663
tasks.withType(CodeNarc) { codeNarcTask ->
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")
}
})
}
gradlePlugin {
website = POM_URL
vcsUrl = POM_URL
testSourceSets sourceSets.funcTest
plugins {
pitest {
id = 'pl.droidsonroids.pitest'
implementationClass = 'pl.droidsonroids.gradle.pitest.PitestPlugin'
tags.addAll('pitest', 'android', 'mutation testing')
displayName = POM_NAME
description = POM_DESCRIPTION
version = VERSION_NAME
group = GROUP
}
pitestAggregator {
id = 'pl.droidsonroids.pitest.aggregator'
tags.addAll('pitest', 'android', 'mutation testing')
implementationClass = 'pl.droidsonroids.gradle.pitest.PitestAggregatorPlugin'
displayName = 'Android Gradle pitest aggregator plugin'
description = POM_DESCRIPTION
}
}
}