forked from scoverage/gradle-scoverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
207 lines (178 loc) · 6.07 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
plugins {
id 'java-gradle-plugin'
id "com.gradle.plugin-publish" version "1.1.0"
id "org.jetbrains.gradle.plugin.idea-ext" version "1.0"
}
repositories {
mavenCentral()
}
group 'org.scoverage'
description = 'gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage'
if (project.version == 'unspecified') {
version = '8.0.0-SNAPSHOT'
}
ext {
website = 'http://scoverage.org'
vcsUrl = 'https://github.com/scoverage/gradle-scoverage.git'
scmUrl = "scm:git:$vcsUrl"
sonatypeUser = System.env.SONATYPE_USER
sonatypePass = System.env.SONATYPE_PASS
}
gradlePlugin {
website = project.ext.website
vcsUrl = project.ext.vcsUrl
description = project.description
plugins {
gradleScoverage {
id = 'org.scoverage'
implementationClass = 'org.scoverage.ScoveragePlugin'
displayName = 'Gradle Scoverage plugin'
description = 'gradle-scoverage is a Gradle plugin for calculating code coverage using Scoverage'
tags.set(['coverage', 'scala', 'scoverage'])
}
}
}
apply plugin: 'maven-publish'
apply plugin: 'groovy'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
dependencies {
compileOnly 'org.scoverage:scalac-scoverage-plugin_2.13.14:2.1.1'
compileOnly 'org.scoverage:scalac-scoverage-reporter_2.13:2.1.1'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
testImplementation 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
}
sourceSets {
functionalTest {
java.srcDir file('src/functionalTest/java')
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
crossScalaVersionTest {
java.srcDir file('src/crossScalaVersionTest/java')
compileClasspath += sourceSets.main.output + sourceSets.functionalTest.output
runtimeClasspath += sourceSets.main.output + sourceSets.functionalTest.output
}
}
configurations {
functionalTestImplementation.extendsFrom testImplementation
functionalTestRuntimeOnly.extendsFrom testRuntimeOnly
crossScalaVersionTestImplementation.extendsFrom testImplementation
crossScalaVersionTestRuntimeOnly.extendsFrom testRuntimeOnly
}
task crossScalaVersionTest(type: Test) {
description = 'Runs the cross scala version functional test.'
group = 'verification'
testClassesDirs = sourceSets.crossScalaVersionTest.output
classpath = sourceSets.crossScalaVersionTest.runtimeClasspath
forkEvery = 1 // crucial to run every test in its own JVM
testLogging {
events 'passed', 'failed', 'skipped'
showStandardStreams = System.env.CI == 'true'
}
mustRunAfter test
}
check.dependsOn crossScalaVersionTest
task functionalTest(type: Test) {
description = 'Runs the functional tests.'
group = 'verification'
testClassesDirs = sourceSets.functionalTest.output
classpath = sourceSets.functionalTest.runtimeClasspath
testLogging {
events 'passed', 'failed', 'skipped'
showStandardStreams = System.env.CI == 'true'
}
systemProperty 'failOnWarning', project.hasProperty('failOnWarning')
mustRunAfter crossScalaVersionTest
}
check.dependsOn functionalTest
gradlePlugin {
testSourceSets sourceSets.functionalTest, sourceSets.crossScalaVersionTest
}
task groovydocJar(type: Jar, dependsOn: groovydoc) {
from "$buildDir/docs/groovydoc"
archiveClassifier.set('groovydoc')
}
def propOrDefault(String property) {
if (project.hasProperty(property)) {
return project.getProperty(property)
} else {
return ''
}
}
publishing {
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials(PasswordCredentials) {
username = propOrDefault('sonatypeUser')
password = propOrDefault('sonatypePass')
}
}
}
publications {
mavenJava(MavenPublication) {
pom {
name = 'GradleScoverage'
description = project.description
url = project.website
scm {
url = scmUrl
developerConnection = scmUrl
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'maiflai'
}
developer {
id = 'ubourdon'
}
developer {
id = 'D-Roch'
}
developer {
id = 'eyalroth'
}
}
}
from components.java
artifact groovydocJar
}
}
}
if (project.properties.containsKey('signing.keyId')) {
apply plugin: 'signing'
signing {
sign publishing.publications.mavenJava
}
project.tasks.publishMavenJavaPublicationToMavenRepository.inputs.files(project.tasks.signMavenJavaPublication)
}
// see https://stackoverflow.com/questions/44679007
task fixIdeaPluginClasspath {
doFirst {
configure(tasks.pluginUnderTestMetadata) {
def ideaClassesPath = project.buildDir.toPath().resolveSibling("out").resolve("production")
def newClasspath = pluginClasspath as List
newClasspath.add(0, ideaClassesPath)
pluginClasspath.setFrom(newClasspath)
}
}
}
pluginUnderTestMetadata.mustRunAfter(fixIdeaPluginClasspath)
idea.project.settings {
taskTriggers {
beforeBuild fixIdeaPluginClasspath, pluginUnderTestMetadata
}
}