forked from szpak/gradle-pitest-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
172 lines (147 loc) · 5.44 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
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'uploadAuth'
ext.isReleaseVersion = !project.version.endsWith("SNAPSHOT")
sourceCompatibility = 1.6
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
//TODO: MZA: Upgrade to 2.0.x when fixed: https://github.com/sebersole/gradle-maven-publish-auth/issues/7
classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.1.1'
}
}
repositories {
mavenCentral()
mavenLocal()
}
sourceSets {
funcTest {
java.srcDir file('src/funcTest/java')
groovy.srcDir file('src/funcTest/groovy')
resources.srcDir file('src/funcTest/resources') //Broken in Idea - https://youtrack.jetbrains.com/issue/IDEA-128966
}
}
dependencies {
compile gradleApi()
compile localGroovy()
testCompile('org.spockframework:spock-core:0.7-groovy-1.8') {
//groovy 1.8.6 is already provided by Gradle itself
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
testCompile 'cglib:cglib-nodep:2.2.2' //for Spying in Spock
testCompile 'junit:junit:4.11'
funcTestCompile sourceSets.main.output
funcTestCompile sourceSets.test.output //to make visible funcTest resources moved to test resources as a workaround for Idea bug
funcTestCompile configurations.testCompile
funcTestRuntime configurations.testRuntime
/*funcT*/testCompile 'com.netflix.nebula:nebula-test:1.12.5' //dependencies from non default configurations are ignored in Idea - https://youtrack.jetbrains.com/issue/IDEA-121728
}
idea {
project {
jdkName = '1.6'
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task groovydocJar(type: Jar, dependsOn: javadocJar) {
classifier = 'groovydoc'
from groovydoc.outputs.files
}
artifacts {
archives sourcesJar
archives javadocJar
archives groovydocJar
}
task funcTest(type: Test) {
testClassesDir = sourceSets.funcTest.output.classesDir
classpath = sourceSets.funcTest.runtimeClasspath
reports.html {
destination = file("${reporting.baseDir}/funcTests")
}
}
funcTest.shouldRunAfter test
check.shouldRunAfter funcTest
task testReport(type: TestReport) {
destinationDir = file("$buildDir/reports/allTests")
reportOn test, funcTest
}
if (isReleaseVersion) {
//activate signing only for release versions (it is not needed for 'gradle install')
apply plugin: 'signing'
signing {
sign configurations.archives
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof org.gradle.plugins.signing.Sign }) {
if (!project.hasProperty("signing.keyId") || !project.hasProperty("signing.secretKeyRingFile")) {
throw new GradleException("signing.keyId and signing.secretKeyRingFile has to be configured (e.g. in ~/.gradle/gradle.properties)")
}
Console console = System.console()
if (console) {
def keyPassword = console.readPassword("\nEnter a private key password: ")
ext."signing.password" = keyPassword
} else {
throw new GradleException("Unable to get console. Make sure to not running a signing task in a daemon mode (e.g. use --no-daemon).")
}
}
}
}
uploadArchives {
repositories {
mavenDeployer {
name = 'Sonatype OSS'
repository(id: 'sonatype-nexus-staging', url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2')
snapshotRepository(id: 'sonatype-nexus-snapshots', url: 'https://oss.sonatype.org/content/repositories/snapshots')
beforeDeployment {
if (isReleaseVersion) {
signing.signPom it
}
}
pom.project {
name 'Gradle PIT Plugin'
description 'Gradle plugin for PIT Mutation Testing'
url 'http://gradle-pitest-plugin.solidsoft.info/'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id 'szpak'
name 'Marcin Zajączkowski'
email 'mszpak ATT wp DOTT pl'
roles {
role 'founder'
role 'despot'
role 'developer'
}
}
}
scm {
connection 'scm:git:git://github.com/szpak/gradle-pitest-plugin.git'
developerConnection 'scm:git:[email protected]:szpak/gradle-pitest-plugin.git'
url 'https://github.com/szpak/gradle-pitest-plugin'
}
}
}
}
}
uploadArchives.dependsOn funcTest, check
//Artifacts are not placed directly into JCenter, so for now a 'gradle-plugin' attribute has to be set manually to
//'info.solidsoft.pitest:info.solidsoft.gradle.pitest:gradle-pitest-plugin' via GUI after sync
wrapper {
gradleVersion '1.12'
}