forked from huxi/lilith
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
769 lines (667 loc) · 22.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
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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
apply from: 'dependencyDefinitions.gradle'
apply from: 'projectDependencies.gradle'
apply plugin: 'versions'
apply plugin: 'base'
apply plugin: 'signing'
apply plugin: 'com.github.kt3k.coveralls' // see https://github.com/kt3k/coveralls-gradle-plugin
import org.apache.tools.ant.filters.FixCrLfFilter
import de.huxhorn.sulky.plist.*
import org.gradle.plugins.signing.Sign
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
def copyright = "Copyright \u00a9 2007-2014 J\u00f6rn Huxhorn"
buildscript {
apply from: 'dependencyDefinitions.gradle'
project.ext.localReleaseRepoFile = new File("${System.properties.'user.home'}/local-gradle-repository/release")
project.ext.localSnapshotRepoFile = new File("${System.properties.'user.home'}/local-gradle-repository/snapshot")
project.ext.localReleaseRepo = localReleaseRepoFile.toURL().toString()
project.ext.localSnapshotRepo = localSnapshotRepoFile.toURL().toString()
repositories {
maven {
url localReleaseRepo
}
maven {
url localSnapshotRepo
}
jcenter()
mavenCentral()
mavenLocal()
maven {
// workaround for http://issues.gradle.org/browse/GRADLE-784
// propdep => provided, optional
url 'http://repo.springsource.org/plugins-release'
}
maven {
// workaround for http://issues.gradle.org/browse/GRADLE-784
// propdep => provided, optional
url 'http://repo.spring.io/plugins-snapshot-local'
}
}
dependencies {
// needed for syncSnapshot and syncStaging
classpath 'org.apache.maven.wagon:wagon-webdav-jackrabbit:1.0-beta-6'
classpath "de.huxhorn.sulky:de.huxhorn.sulky.plist:${versions.sulky}"
classpath 'de.huxhorn.gradle:de.huxhorn.gradle.git-state-plugin:0.0.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.4'
// workaround for http://issues.gradle.org/browse/GRADLE-784
// propdep => provided, optional
// http://repo.spring.io/plugins-release/org/springframework/build/gradle/propdeps-plugin/
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:1.0.2'
// https://code.google.com/p/gradle-macappbundle/
classpath 'edu.sc.seis.gradle:macappbundle:2.0.0'
}
}
apply plugin: 'compare-gradle-builds'
compareGradleBuilds {
sourceBuild {
gradleVersion "1.3"
// tasks = ['clean', 'install']
}
targetBuild {
gradleVersion "1.4"
// tasks = ['clean', 'install']
}
}
task javadoc(type: Javadoc) {
destinationDir = file("$buildDir/javadoc")
source = files { subprojects.collect { it.sourceSets.main.java } }
classpath = files { subprojects.collect { it.sourceSets.main.compileClasspath } }
}
task sourceZip(type: Zip) {
classifier = 'sources'
from { subprojects.collect { it.sourceSets.main.allSource } }
}
task javadocZip(type: Zip) {
classifier = 'javadoc'
from javadoc.outputs.files
}
signing {
required = { !version.endsWith("SNAPSHOT") }
sign javadocZip
sign sourceZip
}
gradle.taskGraph.whenReady { taskGraph ->
if(taskGraph.allTasks.any { it instanceof Sign && it.required }) {
String pgpPassword = System.properties.'pgpPassword'
if(!pgpPassword) {
Console console = System.console()
if(!console) {
throw new IllegalStateException('System.console() returned null. Restart with --no-daemon.')
}
pgpPassword = new String(console.readPassword("\nPGP Private Key Password: "))
}
allprojects { ext.'signing.keyId' = '740A1840' }
allprojects { ext.'signing.secretKeyRingFile' = new File("${System.properties['user.home']}/.gnupg/secring.gpg").absolutePath }
allprojects { ext."signing.password" = pgpPassword }
}
}
if(!System.properties.'release') {
defaultTasks 'build', 'uploadPublished', 'jarAll', 'myDistZip', 'myDistTgz', 'appTgz'
} else {
defaultTasks 'build', 'uploadPublished', 'jarAll', 'myDistZip', 'myDistTgz', 'appTgz', 'signJavadocZip', 'signSourceZip'
}
allprojects {
apply plugin: 'project-reports'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
group = 'de.huxhorn.lilith'
version = '0.9.45'
if(!System.properties.'release') {
version = version + '-SNAPSHOT'
}
repositories {
maven {
url localReleaseRepo
}
maven {
url localSnapshotRepo
}
mavenCentral()
mavenLocal()
}
jacoco {
toolVersion = '0.7.1.201405082137'
}
}
subprojects {
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
//defaultTasks 'build', 'uploadPublished'
sourceCompatibility = 1.5
targetCompatibility = 1.5
// -Xlint:-options disables the
// "warning: [options] bootstrap class path not set in conjunction with -source 1.x"
// for now
def compilerArgs = ['-Xlint:unchecked', '-Xlint:-options', '-Xlint:deprecation', '-g']
compileJava.options.compilerArgs = compilerArgs
compileTestJava.options.compilerArgs = compilerArgs
compileGroovy.options.compilerArgs = compilerArgs
compileTestGroovy.options.compilerArgs = compilerArgs
def sourceEncoding = 'UTF-8'
compileJava.options.encoding = sourceEncoding
compileTestJava.options.encoding = sourceEncoding
compileGroovy.options.encoding = sourceEncoding
compileTestGroovy.options.encoding = sourceEncoding
javadoc.options.encoding = sourceEncoding
signing {
required = { !version.endsWith("SNAPSHOT") }
sign configurations.archives
}
boolean gpl=['lilith', 'lilith-conditions', 'lilith-engine', 'lilith-xml-logging'].contains(project.name)
task sourceJar(type: Jar) { from sourceSets.main.allSource; classifier = 'sources' }
task javadocJar(type: Jar) { from javadoc.outputs.files; classifier = 'javadoc' }
artifacts { archives sourceJar, javadocJar }
project.ext.defaultProject= {
url 'http://lilith.huxhorn.de'
name project.name
description project.description
inceptionYear '2007'
//packaging 'jar' // does not work, fixed below
// See http://jira.codehaus.org/browse/GRADLE-1200
scm {
connection 'scm:git:git://github.com/huxi/lilith.git'
developerConnection 'scm:git:ssh://[email protected]:huxi/lilith.git'
url 'http://github.com/huxi/lilith/'
}
licenses {
if(gpl)
{
license {
name 'GNU General Public License v3 (GPL)'
url 'http://www.gnu.org/licenses/gpl.html'
distribution 'repo'
}
}
else
{
license {
name 'GNU Lesser General Public License v3 (LGPL)'
url 'http://www.gnu.org/copyleft/lesser.html'
distribution 'repo'
}
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
issueManagement {
system 'trac'
url 'http://apps.sourceforge.net/trac/lilith/'
}
mailingLists {
mailingList {
name 'Announce List'
subscribe '[email protected]'
unsubscribe '[email protected]'
post '[email protected]'
archive 'http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-announce'
}
mailingList {
name 'User List'
subscribe '[email protected]'
unsubscribe '[email protected]'
post '[email protected]'
archive 'http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-user'
}
mailingList {
name 'Developer List'
subscribe '[email protected]'
unsubscribe '[email protected]'
post '[email protected]'
archive 'http://sourceforge.net/mailarchive/forum.php?forum_name=lilith-devel'
}
}
developers {
developer {
id 'huxhorn'
email '[email protected]'
name 'Joern Huxhorn'
organization = 'Joern Huxhorn'
organizationUrl 'http://lilith.huxhorn.de'
roles {
role 'Developer'
}
}
}
properties {
'project.build.sourceEncoding' 'UTF-8'
'project.reporting.outputEncoding' 'UTF-8'
}
}
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
all*.exclude group: 'org.codehaus.groovy', module: 'groovy-all'
published.extendsFrom archives, signatures
}
dependencies {
testCompile libraries.'groovy'
testCompile libraries.'spock-core'
testCompile libraries.junit
testCompile libraries.'slf4j-api'
testRuntime libraries.'logback-classic'
}
jar {
manifest.attributes provider: 'gradle'
}
def deployer = null
uploadPublished {
deployer = repositories.mavenDeployer {
repository(url: localReleaseRepo)
snapshotRepository(url: localSnapshotRepo)
beforeDeployment { MavenDeployment deployment ->
signing.signPom(deployment)
}
}
}
def installer = install.repositories.mavenInstaller
installer.pom.project defaultProject
deployer.pom.project defaultProject
// The following fixes the broken packaging
// See http://jira.codehaus.org/browse/GRADLE-1200
// Thanks xlson
/*
installer.pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parseText(xml.toString())
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
deployer.pom.withXml { XmlProvider xmlProvider ->
def xml = xmlProvider.asString()
def pomXml = new XmlParser().parseText(xml.toString())
pomXml.version[0] + { packaging('jar') }
def newXml = new StringWriter()
def printer = new XmlNodePrinter(new PrintWriter(newXml))
printer.preserveWhitespace = true
printer.print(pomXml)
xml.setLength(0)
xml.append(newXml.toString())
}
*/
}
project(':lilith') {
apply plugin: 'application'
apply plugin: de.huxhorn.gradle.git.GitStatePlugin
apply plugin: 'macAppBundle'
/*
### macappbundle
- [Gradle Plugin Homepage](https://code.google.com/p/gradle-macappbundle/)
- [MacAppBundlePluginExtension](https://code.google.com/p/gradle-macappbundle/source/browse/src/main/groovy/edu/sc/seis/gradle/macAppBundle/MacAppBundlePluginExtension.groovy)
- Artifact: `'edu.sc.seis.gradle:macappbundle:2.0.0'`
- http://kovuthehusky.com/blog/running-minecraft-on-os-x-using-java-7/
- https://bugs.mojang.com/browse/MCL-1049
- https://bugs.mojang.com/browse/MCL-2628
- https://gist.github.com/pudquick/7518753
- http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/package_for_mac.html
*/
if(System.properties.'release') {
project.git.requireClean = true
processResources.dependsOn checkGitState
}
def theMainClassName = 'de.huxhorn.lilith.Lilith'
mainClassName = theMainClassName
macAppBundle {
mainClassName = theMainClassName
appName = 'Lilith'
creatorCode = 'Llth'
//jvmVersion = '1.8+'
//jvmVersion is AppleJava only
icon = "${projectDir}/src/main/mac-resources/Lilith.icns"
bundleExtras = [
'CFBundleShortVersionString': version,
//'CFBundleGetInfoString': copyright,
'NSHumanReadableCopyright': copyright,
'NSHighResolutionCapable':'true',
//'CFBundleIdentifier': 'de.huxhorn.lilith'
// not possible to override CFBundleIdentifier
]
javaProperties = [
'apple.laf.useScreenMenuBar': 'true'
]
}
createDmg {
enabled false
}
jar {
manifest.attributes(
'Main-Class': "${mainClassName}",
// Class-Path must be evaluated at runtime not configuration time.
// see http://gradle.1045684.n5.nabble.com/Manifest-classpath-incomplete-and-distribution-ZIP-empty-td2635807.html
'Class-Path': "${ -> configurations.runtime.collect { File file -> file.name }.sort().join(' ')}"
)
}
processResources {
def props = [
'lilithVersion': version,
'slf4jVersion': versions.slf4j,
'logbackVersion': versions.logback,
'gitRevision': project.gitHeadHash,
'timestamp': "${System.currentTimeMillis()}"
]
// props is manually added as input to circumvent the following issues:
// - Change in filtered resource not picked up by archive tasks
// http://issues.gradle.org/browse/GRADLE-1298
// - processResources task considered up-to-date although its spec has changed
// http://jira.codehaus.org/browse/GRADLE-1276
// - Copy tasks do not consider filter/expansion properties in up-to-date checks
// http://issues.gradle.org/browse/GRADLE-1646
inputs.properties props
// See also:
// http://forums.gradle.org/gradle/topics/1_7_rc_1_probably_erroneous_including_duplicate_file_warnings
filesMatching '**/*.properties', { expand props }
filesMatching '**/*.xhtml', { expand props }
}
project.ext.distSpec = copySpec {
into("lilith-${version}") {
//println "projectDir: ${projectDir}"
from(projectDir) {
include 'COPYING'
include 'COPYING.LESSER'
include 'LICENSE-2.0.txt'
include 'build.txt'
}
from(projectDir) {
include 'readme.txt'
expand(
'lilithVersion': version,
'slf4jVersion': versions.slf4j,
'logbackVersion': versions.logback,
'log4jVersion': versions.log4j,
'commonsLoggingVersion': versions.commonsLogging,
)
}
into('bin') {
from("${projectDir}/src/bin") {
include 'lilith.bat'
}
}
into('bin') {
from("${projectDir}/src/bin") {
include 'lilith'
fileMode = 0755
filter(FixCrLfFilter,
eol: FixCrLfFilter.CrLf.newInstance('lf'),
tab: FixCrLfFilter.AddAsisRemove.newInstance('asis'),
eof: FixCrLfFilter.AddAsisRemove.newInstance('remove'),
fixlast: true)
}
}
into('lib') {
from configurations.default
from configurations.default.allArtifacts.files
exclude '*-sources.jar'
exclude '*-javadoc.jar'
rename 'de.huxhorn.lilith-(.*).jar', 'lilith.jar'
}
}
}
task jarAll(dependsOn: configurations.default.allArtifacts.buildDependencies, type: Jar) {
description = 'Creates a shaded/uberjar/fatjar of the application.'
classifier = 'all'
manifest.attributes(
'Main-Class': "${mainClassName}"
)
from (sourceSets.main.output.classesDir)
from (sourceSets.main.output.resourcesDir)
doFirst { // <- note the doFirst
// the following must be executed in doFirst since the configuration
// has not been initialized at configuration time
from (configurations.runtime.resolve().collect { it.isDirectory() ? it : zipTree(it) }) {
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
}
}
task myDistZip(dependsOn: configurations.default.allArtifacts.buildDependencies, type: Zip) {
description = 'Creates a ZIP containing the Lilith distribution.'
classifier = 'bin'
with distSpec
}
task myDistTgz(dependsOn: configurations.default.allArtifacts.buildDependencies, type: Tar) {
description = 'Creates a TGZ containing the Lilith distribution.'
classifier = 'bin'
compression = Compression.GZIP
with distSpec
}
/*
task preparePropertyList(dependsOn: configurations.default.allArtifacts.buildDependencies) << {
File propFile=file('src/main/mac-resources/Info.plist')
PropertyList plist
if(propFile.isFile())
{
PropertyListDecoder decoder=new PropertyListDecoder()
plist=decoder.decode(new FileInputStream(propFile))
}
//println("PropertyList before: ${plist}")
if(!plist)
{
plist=new PropertyList()
}
if(!plist.root)
{
plist.root=new TreeMap()
}
else
{
plist.root=new TreeMap(plist.root)
}
String bundleName='Lilith'
plist.root.'CFBundleName'="${bundleName}"
plist.root.'CFBundleIdentifier'='de.huxhorn.lilith'
plist.root.'CFBundleVersion'="${version}"
plist.root.'CFBundleGetInfoString'="${bundleName} ${version}, ${copyright}"
plist.root.'CFBundleShortVersionString'="${version}"
plist.root.'CFBundleAllowMixedLocalizations'='true'
plist.root.'CFBundleExecutable'='JavaApplicationStub'
plist.root.'CFBundleDevelopmentRegion'='English'
plist.root.'CFBundlePackageType'='APPL'
//plist.root.'CFBundleSignature'='Llth'
plist.root.'CFBundleInfoDictionaryVersion'='6.0'
plist.root.'CFBundleIconFile'='Lilith.icns'
List macClasspath=new ArrayList()
//println configurations.default
configurations.default.collect { File file ->
String currentName='$JAVAROOT/'+file.name
if(!currentName.endsWith('-sources.jar') && !currentName.endsWith('-javadoc.jar')
&& !macClasspath.contains(currentName))
{
macClasspath.add(currentName)
//println "Added ${currentName}"
}
}
//println "classpath 1 = ${macClasspath}"
//println configurations.default.allArtifactFiles
configurations.default.allArtifacts.files.collect { File file ->
String currentName='$JAVAROOT/'+file.name
if(!currentName.endsWith('-sources.jar') && !currentName.endsWith('-javadoc.jar')
&& !macClasspath.contains(currentName))
{
macClasspath.add(currentName)
//println "Added ${currentName}"
}
}
//println "classpath 2 = ${macClasspath}"
//String foo = "${ -> configurations.runtime.collect { File file -> file.name }.sort().join(' ')}"
//println foo
configurations.runtime.collect { File file ->
String currentName='$JAVAROOT/'+file.name
if(!currentName.endsWith('-sources.jar') && !currentName.endsWith('-javadoc.jar')
&& !macClasspath.contains(currentName))
{
macClasspath.add(currentName)
//println "Added ${currentName}"
}
}
//println "classpath 3 = ${macClasspath}"
Collections.sort(macClasspath)
Map javaMap=plist.root.'Java'
if(!javaMap)
{
javaMap=new TreeMap()
plist.root.'Java'=javaMap
}
else
{
javaMap=new TreeMap(javaMap)
plist.root.'Java'=javaMap
}
javaMap.'MainClass'="${mainClassName}"
javaMap.'JVMVersion'='1.5+'
javaMap.'ClassPath'=macClasspath
javaMap.'VMOptions'='-Dcom.apple.macos.useScreenMenuBar=true'
//println("PropertyList after: ${plist}")
File propOutFile=file('build/Info.plist')
propOutFile.parentFile.mkdirs()
PropertyListEncoder encoder=new PropertyListEncoder()
plist=encoder.encode(plist, new FileOutputStream(propOutFile))
}
project.ext.appSpec = copySpec {
into("Lilith.app") {
into('Contents') {
from("${projectDir}/build/Info.plist")
}
into('Contents/Resources') {
from("${projectDir}/src/main/mac-resources/Lilith.icns")
}
into('Contents/MacOS') {
from("${projectDir}/src/main/mac-resources/JavaApplicationStub")
fileMode = 0755
}
into('Contents/Resources/Java') {
from configurations.default
from configurations.default.allArtifacts.files
exclude '*-sources.jar'
exclude '*-javadoc.jar'
}
}
}
task copyApp(dependsOn: preparePropertyList, type: Copy) {
with appSpec
into file('build/explodedApp')
}
task appTgz(dependsOn: preparePropertyList, type: Tar) {
description = 'Creates a TGZ containing the Lilith Mac OS X app.'
classifier = 'app'
compression = Compression.GZIP
with appSpec
}
*/
task appTgz(dependsOn: createApp, type: Tar) {
description = 'Creates a TGZ containing the Lilith Mac OS X app.'
classifier = 'app'
compression = Compression.GZIP
from "${projectDir}/build/macApp"
}
signing {
required = { !version.endsWith("SNAPSHOT") }
sign jarAll
sign distZip
sign myDistZip
sign myDistTgz
sign appTgz
}
}
// source: https://gist.github.com/aalmiray/e6f54aa4b3803be0bcac
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.jacocoTestReport
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
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
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
}
coveralls {
jacocoReportPath = 'build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml'
sourceDirs += jacocoRootReport.sourceDirectories
}
project.ext.deleteClosure = {
// delete content of it recursively
it.eachDir( deleteClosure );
it.eachFile {
if(it.delete()) {
logger.debug("Deleted ${it.absolutePath}.")
}
}
}
task (group: 'Repository', description: "Cleans the local staging-repository, i.e. '${localReleaseRepoFile.absolutePath}'.", 'cleanStaging') << {
deleteClosure(localReleaseRepoFile)
logger.info("Deleted content of ${localReleaseRepoFile.absolutePath}.")
}
task (group: 'Repository', description: "Cleans the local SNAPSHOT-repository, i.e. '${localSnapshotRepoFile.absolutePath}'.", 'cleanSnapshot') << {
deleteClosure(localSnapshotRepoFile)
logger.info("Deleted content of ${localReleaseRepoFile.absolutePath}.")
}
task (group: 'Repository', description: 'Sync local staging-repository to oss.sonatype.org.', 'syncStaging') << {
if (project.hasProperty('remoteUsername') && project.hasProperty('remotePassword')) {
def stagingRepos = new org.apache.maven.wagon.repository.Repository('staging', 'https://oss.sonatype.org/service/local/staging/deploy/maven2')
def auth = new org.apache.maven.wagon.authentication.AuthenticationInfo()
auth.userName = remoteUsername
auth.password = remotePassword
def wagon = new org.apache.maven.wagon.providers.webdav.WebDavWagon()
wagon.connect(stagingRepos, auth)
localReleaseRepoFile.eachFile {
if (it.directory) {
wagon.putDirectory(it, it.name)
} else {
wagon.put(it, it.name)
}
}
} else {
println "Can't sync staging as credentials aren't set. Set with -PremoteUsername=user -PremotePassword=password."
}
}
task (group: 'Repository', description: 'Sync local SNAPSHOT-repository to oss.sonatype.org.', 'syncSnapshot') << {
if (project.hasProperty('remoteUsername') && project.hasProperty('remotePassword')) {
def snapshotRepos = new org.apache.maven.wagon.repository.Repository('snapshot', 'https://oss.sonatype.org/content/repositories/snapshots')
def auth = new org.apache.maven.wagon.authentication.AuthenticationInfo()
auth.userName = remoteUsername
auth.password = remotePassword
def wagon = new org.apache.maven.wagon.providers.webdav.WebDavWagon()
wagon.connect(snapshotRepos, auth)
localSnapshotRepoFile.eachFile {
if (it.directory) {
wagon.putDirectory(it, it.name)
} else {
wagon.put(it, it.name)
}
}
} else {
println "Can't sync snapshots as credentials aren't set. Set with -PremoteUsername=user -PremotePassword=password."
}
}