forked from puniverse/capsule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
259 lines (220 loc) · 7.65 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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
// classpath 'net.saliman:gradle-cobertura-plugin:2.2.4'
classpath 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.1.1'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0'
}
}
allprojects {
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'jacoco' // 'cobertura'
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'info.solidsoft.pitest'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
group = "co.paralleluniverse"
version = "1.0.4-SNAPSHOT"
status = "integration"
description = "Simple Java deployment"
ext.url = "https://github.com/puniverse/capsule"
ext.vendor = "Parallel Universe Software Co."
ext.licenseName = "Eclipse Public License - v 1.0"
ext.licenseUrl = "http://www.eclipse.org/legal/epl-v10.html"
ext.scmUrl = "https://github.com/puniverse/capsule"
ext.scmConnection = "https://github.com/puniverse/capsule.git"
ext.distDir = "$buildDir/dist"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
// User and Password are taken from ~/.gradle/gradle.properties
if (!project.hasProperty("sonatypeUsername") || !project.hasProperty("sonatypePassword")) {
println "sonatype username or password not set"
ext.sonatypeUsername = ""
ext.sonatypePassword = ""
}
configurations {
javancss
}
configurations {
[compile, runtime]*.resolutionStrategy {
failOnVersionConflict()
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.truth0:truth:0.23'
testCompile 'com.google.jimfs:jimfs:1.1'
testCompile 'org.jooq:joor:0.9.6'
javancss 'org.codehaus.javancss:javancss:33.54'
}
test {
systemProperty "java.protocol.handler.pkgs", "co.paralleluniverse.filesystem"
beforeTest { desc ->
logger.quiet("Running test: " + desc)
}
afterTest { desc, result ->
if(result.resultType == TestResult.ResultType.FAILURE) {
logger.quiet("Failed test ${desc.name} [${desc.className}] with exception: ${result.exception}")
if(result.exception != null) {
result.exception.printStackTrace()
}
}
}
}
pitest {
targetClasses = ['Capsule', 'capsule.*', 'co.paralleluniverse.*']
targetTests = ['CapsuleTest', 'capsule.*', 'co.paralleluniverse.*']
jvmArgs = ['-Djava.protocol.handler.pkgs=co.paralleluniverse.filesystem']
}
task run(type: JavaExec, dependsOn:[testClasses]) {
classpath = sourceSets.main.runtimeClasspath
if(project.hasProperty('mainClass')){
main = project.mainClass
}
if(project.hasProperty('args')){
args project.args.split('\\s+')
}
}
tasks.withType(JavaExec) {
classpath += sourceSets.test.runtimeClasspath
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
csv.enabled = false
// xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport_${project.name}.xml"
}
}
// check.dependsOn jacocoTestReport
javadoc {
options.links = [ "http://docs.oracle.com/javase/7/docs/api/" ]
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
// }
task javancss(dependsOn: 'classes') << {
ant {
logging.level = LogLevel.INFO
taskdef(name:'javancss', classname:'javancss.JavancssAntTask', classpath: configurations.javancss.asPath)
javancss(
srcdir:'src/main/java',
abortOnFail:'true',
generateReport:'true',
packageMetrics:'true',
classMetrics:'false',
functionMetrics:'false'
// outputFile: reportName,
)
}
}
assemble.dependsOn javancss
///////// Publish Artifacts
apply plugin: 'maven'
apply plugin: 'signing'
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { deployment -> signing.signPom(deployment) }
repository(
url: (isReleaseVersion ?
"https://oss.sonatype.org/service/local/staging/deploy/maven2" :
"https://oss.sonatype.org/content/repositories/snapshots")) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name project.name
packaging 'jar'
description project.description
url project.url
scm {
url project.scmUrl
connection project.scmConnection
developerConnection project.scmConnection
}
licenses {
license {
name project.licenseName
url project.licenseUrl
distribution 'repo'
}
}
developers {
developer {
id 'pron'
name 'Ron Pressler'
}
}
}
}
}
}
defaultTasks 'build'
}
project (':capsule') {
dependencies {
testCompile project(':capsule-util')
}
jar {
manifest {
attributes('Main-Class' : 'Capsule',
'Premain-Class' : 'Capsule')
}
}
javadoc {
options.noDeprecated = true
excludes = [ "capsule/**" ]
}
}
project (':capsule-util') {
dependencies {
runtime project(':capsule')
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
}
javadoc {
excludes = ["co/paralleluniverse/common/**",
"co/paralleluniverse/filesystem/**"
]
}
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
xml.destination = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}
}
coveralls {
sourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs).files.absolutePath
jacocoReportPath = "${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
}