forked from Qi4j/qi4j-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
654 lines (580 loc) · 23 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
project.ext {
title = "Qi4j SDK"
description = "Qi4j™ is a framework for domain centric application development, including evolved concepts from AOP, DI and DDD."
testFailures = [ ]
mainClassName = 'org.qi4j.container.Main'
groovycMain_mx = "700m"
groovycMain_permSize = "256m"
groovycMain_maxPermSize = "256m"
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'signing'
apply plugin: 'maven'
apply from: 'maven-compat.gradle'
apply plugin: 'project-report'
apply from: 'libraries.gradle'
targetCompatibility = "1.7"
sourceCompatibility = "1.7"
// Collect the modules that fulfills the Release Criteria.
project.ext {
releaseSpec = new org.qi4j.gradle.plugin.ModuleReleaseSpecification()
}
def releaseApprovedProjects = allprojects.findAll( { project -> rootProject.ext.releaseSpec.satisfiedBy( project ) } )
buildscript {
repositories {
mavenCentral()
}
}
// External tools BEGIN ---------------------------------------------------
// IDEA plugin configuration
idea.project.ipr {
withXml { provider ->
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
}
}
// External tools END -----------------------------------------------------
// Define repositories URLs here so we can reuse them in the build script
// Needed as Gradle forbid access to declared repositories URLs by design
// Releasable submodules should not declare repositories in their own build files
def repos_urls = [
mavenCentral: "http://repo1.maven.org/maven2/",
ops4j: "http://repository.ops4j.org/maven2/",
restlet: 'http://maven.restlet.org',
javanet: "http://download.java.net/maven/2",
clojars: "http://clojars.org/repo/",
]
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'signing'
apply plugin: 'java'
// apply plugin: 'checkstyle'
apply plugin: 'project-report'
apply plugin: 'maven'
defaultTasks 'classes', 'test'
group = name.substring( 0, name.lastIndexOf( '.' ) )
version = System.properties.version ?: "0"
// UTF-8 For all compilations and javadocs
// Deprecation warnings for all compilations
// Unchecked warnings for non-test core compilations
tasks.withType(Compile) {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:deprecation"
}
if("core".equals(group)) {
tasks.matching({ task -> task instanceof Compile && !task.name.contains('test') }).
each({ task -> task.options.compilerArgs << "-Xlint:unchecked" })
}
tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
maven { name 'ops4j-repo'; url repos_urls.ops4j }
maven { name 'restlet-repo'; url repos_urls.restlet }
maven { name 'maven2-repository.dev.java.net'; url repos_urls.javanet }
maven { name 'clojars-repo'; url repos_urls.clojars }
}
// Artifact upload global configuration BEGIN -----------------------------
def uploadSnapshots = version.contains("SNAPSHOT")
def uploadReleases = ! uploadSnapshots
// By default RELEASES are signed, SNAPSHOTS are not
// Signing can be turned on or off by setting the uploadSigned property
def uploadSigned = rootProject.hasProperty('uploadSigned') \
? rootProject.uploadSigned : uploadReleases \
? true : false
// By default RELEASES must satisfy ReleaseSpecification, SNAPSHOT don't
// ReleaseSpecification usage can be turned on or off by setting the uploadReleaseSpec property
def uploadReleaseSpec = rootProject.hasProperty('uploadReleaseSpec') \
? rootProject.uploadReleaseSpec : uploadReleases \
? true : false
// By default RELEASES are uploaded using SSH, SNAPSHOTS using WEBDAV
// Used Wagon can be overriden by setting the uploadWagon property
// def wagonSSH = "org.apache.maven.wagon:wagon-ssh:1.0-beta-2"
def wagonWEBDAV = "org.apache.maven.wagon:wagon-webdav:1.0-beta-2"
def uploadWagon = rootProject.hasProperty('uploadWagon') \
? rootProject.uploadWagon : wagonWEBDAV
// By default RELEASES are uploaded to OPS4J, SNAPSHOTS to Cloudbees
// Target repository can be overriden by setting the uploadRepository property
def releasesRepository = "dav:https://repository-qi4j.forge.cloudbees.com/release/"
def snapshotsRepository = "dav:https://repository-qi4j.forge.cloudbees.com/snapshot/"
def uploadRepository = rootProject.hasProperty('uploadRepository') \
? rootProject.uploadRepository \
: uploadReleases ? releasesRepository : snapshotsRepository
// No username/password is provided by default
// If needed set them using the uploadUsername and uploadPassword properties
def uploadUsername = rootProject.hasProperty('uploadUsername') ? rootProject.uploadUsername : null
def uploadPassword = rootProject.hasProperty('uploadPassword') ? rootProject.uploadPassword : null
// Artifact upload global configuration END -------------------------------
configurations {
archives
deployerJars
provided
compile.extendsFrom provided
runtime.extendsFrom compile
}
dependencies {
testCompile( libraries.ant )
testCompile( libraries.ant_junit )
testCompile( libraries.junit )
testRuntime( libraries.asm, libraries.asm_commons, libraries.asm_util )
deployerJars( uploadWagon )
}
test.onlyIf { !project.hasProperty( 'skipTests' ) }
test {
testLogging {
info {
exceptionFormat "full"
}
}
}
sourceSets {
docs {
resources {
srcDir 'src/docs'
}
}
}
project.ext {
javaDir = new File( "$projectDir/src/main/java" )
scalaDir = new File( "$projectDir/src/main/scala" )
documentationDir = new File( "$projectDir/src/docs" )
testJavaDir = new File( "$projectDir/src/tests/java" )
testScalaDir = new File( "$projectDir/src/tests/scala" )
}
// Actual code projects BEGIN -------------------------------------------
if( ext.javaDir.isDirectory() || ext.scalaDir.isDirectory() ||
ext.testJavaDir.isDirectory() || ext.testScalaDir.isDirectory() )
{
apply plugin: 'jacoco'
apply plugin: 'osgi'
apply plugin: VersionClass
apply plugin: AsciidocBuildInfo
// if( name == "org.qi4j.core.runtime" )
// {
// checkstyleMain {
// configFile = new File( "$rootProject.projectDir.absolutePath/etc/qi4j-runtime-checkstyle.xml" )
// ignoreFailures = true
// }
// }
// else
// {
// checkstyleMain {
// configFile = new File( rootProject.projectDir.absolutePath.toString() + '/etc/qi4j-api-checkstyle.xml' )
// ignoreFailures = true
// reporting.baseDir = "$rootProject.reporting.baseDir/checkstyle"
// }
// }
// checkstyleTest {
// configFile = new File( "$rootProject.projectDir.absolutePath/etc/qi4j-tests-checkstyle.xml" )
// ignoreFailures = true
// }
//
// checkstyleVersion {
// configFile = new File( "$rootProject.projectDir.absolutePath/etc/qi4j-tests-checkstyle.xml" )
// ignoreFailures = true
// }
jar {
manifest {
license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
docURL = 'http://www.qi4j.org'
description = project.description ?: 'Qi4j is a platform for Composite Oriented Programming'
vendor = 'Qi4j Community, http://www.qi4j.org'
instruction '-debug', 'true'
}
}
signing {
required { uploadSigned }
sign configurations.archives
}
task sourceJar( type: Jar ) {
classifier = "sources"
from sourceSets.main.allSource
}
task testSourceJar( type: Jar ) {
classifier = "testsources"
from sourceSets.test.allSource
}
task javadocJar( type: Jar ) {
classifier = "javadoc"
from javadoc.destinationDir
dependsOn javadoc
}
artifacts {
archives sourceJar, testSourceJar, javadocJar
}
def testProperties = [
'proxySet': System.properties[ 'proxySet' ],
'proxyHost': System.properties[ 'proxyHost' ],
'proxyPort': System.properties[ 'proxyPort' ] ]
test {
maxHeapSize = "1024m"
systemProperties = testProperties
systemProperties['user.dir'] = workingDir // GRADLE-2859
ignoreFailures = true
testReport = true
afterSuite { descriptor, result ->
if( result.resultType == TestResult.ResultType.FAILURE )
{
rootProject.ext.testFailures << project
}
}
}
// // Create checkstyle report
// task checkstyleReport( type: Xslt, dependsOn: check ) {
// source project.checkstyle.reportsDir
// include '*.xml'
// destDir = file( "build/reports/checkstyle/" )
// extension = 'html'
// stylesheetFile = file( "$rootProject.projectDir/etc/checkstyle-noframes.xsl" )
// }
//
// Dependency Report generate only the runtime configuration
// The report is packaged in the SDK distributions
dependencyReport {
configurations = [ project.configurations.runtime ]
}
task minBuild {
dependsOn classes
dependsOn test
}
}
// Actual code projects END ---------------------------------------------
// Upload Archives - Artifact Deployment
uploadArchives.doFirst {
if( version == "0" )
{
throw new GradleException( "'version' must be given as a system property to perform a release." )
}
}
uploadArchives.onlyIf { ( !uploadReleaseSpec || ( releaseApprovedProjects.contains( project ) || project == rootProject ) ) && !project.hasProperty( 'skipUpload' ) }
uploadArchives {
dependsOn check
repositories.mavenDeployer {
if( uploadSigned )
beforeDeployment { MavenDeployment deployment -> signing.signPom( deployment ) }
configuration = configurations.deployerJars
repository(url: uploadRepository) {
if( uploadUsername )
authentication(userName: uploadUsername, password: uploadPassword)
}
snapshotRepository(url: uploadRepository) {
if( uploadUsername )
authentication(userName: uploadUsername, password: uploadPassword)
}
}
}
idea.module.iml {
whenMerged { module ->
module.dependencies*.exported = true
}
}
} // allprojects END -------------------------------------------------------
gradle.taskGraph.whenReady {taskGraph ->
taskGraph.allTasks.last().doLast {
if( rootProject.ext.testFailures )
{
println "\nTest failures in:"
rootProject.ext.testFailures.unique().each { project -> println " " + project.name }
println ""
throw new RuntimeException( "There was TEST FAILURES!! See list above." )
}
}
}
task globalTestReport( type: TestReport ) {
destinationDir = file("$buildDir/reports/tests")
reportOn subprojects*.test
}
test {
dependsOn subprojects*.test, globalTestReport
testReport = false
}
// Jacoco
configurations {
jacoco
}
dependencies {
jacoco 'org.jacoco:org.jacoco.ant:0.6.4.201312101107'
}
// Generate a global code codeverage report
task coverageReport {
dependsOn subprojects*.test
def outputPath = "build/reports/coverage"
def coveredProjects = subprojects.findAll { p -> new File( "${p.buildDir.path}/jacoco" ).exists() }
def coreProjects = coveredProjects.findAll { p -> p.name.startsWith('org.qi4j.core' ) }
def libProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.qi4j.lib' ) }
def extProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.qi4j.ext' ) }
def toolsProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.qi4j.tool' ) }
def tutoProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.qi4j.tuto' ) }
def samplesProjects = coveredProjects.findAll { p -> p.name.startsWith( 'org.qi4j.sample' ) }
ant {
taskdef name:'jacocoreport', classname: 'org.jacoco.ant.ReportTask', classpath: configurations.jacoco.asPath
mkdir dir: outputPath
jacocoreport {
executiondata {
coveredProjects.collect { p -> fileset( dir: "${p.buildDir.path}/jacoco" ) { include( name: '*.exec' ) } }
}
structure( name: "Qi4j SDK" ) {
group( name: "Core" ) {
classfiles { coreProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { coreProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
group( name: "Libraries" ) {
classfiles { libProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { libProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
group( name: "Extensions" ) {
classfiles { extProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { extProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
group( name: "Tools" ) {
classfiles { toolsProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { toolsProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
group( name: "Tutorials" ) {
classfiles { tutoProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { tutoProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
group( name: "Samples" ) {
classfiles { samplesProjects.collect { p -> fileset dir: "${p.buildDir.path}/classes/main" } }
sourcefiles { samplesProjects.collect { p -> fileset dir: "${p.projectDir.path}/src/main/java" } }
}
}
csv destfile: "${outputPath}/jacoco.csv", encoding: "UTF-8"
xml destfile: "${outputPath}/jacoco.xml", encoding: "UTF-8"
html destdir: outputPath, encoding: "UTF-8", locale: "en", footer: "Qi4j SDK"
}
}
inputs.dir coveredProjects.collect { p -> "${p.buildDir.path}/jacoco" }
outputs.dir outputPath
}
// Build the whole SDK public Javadoc
task javadocs( type: Javadoc ) {
options.docFilesSubDirs = true
options.encoding = "UTF-8"
options.overview = "${rootProject.projectDir}/buildSrc/src/javadoc/overview.html"
title = "${rootProject.title} ${version}"
def apiSources = releaseApprovedProjects.findAll( { project ->
( project.name.startsWith( 'org.qi4j.core' ) && !project.name.startsWith( 'org.qi4j.core.runtime' ) ) ||
project.name.startsWith( 'org.qi4j.library' ) ||
project.name.startsWith( 'org.qi4j.extension' ) ||
project.name.startsWith( 'org.qi4j.tool' )
} )
source apiSources.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File( "" + buildDir + '/docs/javadoc' )
// Might need a classpath
classpath = files( apiSources.collect { project ->
project.sourceSets.main.compileClasspath
} )
options.links( "http://docs.oracle.com/javase/7/docs/api/" )
options.group( [ "Core API": [ "org.qi4j.api", "org.qi4j.api.*", "org.qi4j.io", "org.qi4j.functional" ],
"Core Bootstrap": [ "org.qi4j.bootstrap", "org.qi4j.bootstrap.*" ],
"Core SPI": [ "org.qi4j.spi", "org.qi4j.spi.*" ],
"Libraries": [ "org.qi4j.library.*", "org.qi4j.logging", "org.qi4j.logging.*", "org.qi4j.lang.*" ],
"Extensions": [ "org.qi4j.valueserialization.*", "org.qi4j.entitystore.*", "org.qi4j.index.*", "org.qi4j.metrics.*", "org.qi4j.cache.*", "org.qi4j.migration", "org.qi4j.migration.*" ],
"Tools": [ "org.qi4j.tools.*", "org.qi4j.envisage", "org.qi4j.envisage.*", "org.qi4j.library.swing.entityviewer" ],
"Test Support": [ "org.qi4j.test", "org.qi4j.test.*" ]
] )
}
task archiveJavadocs(type: Copy ) {
dependsOn javadocs
if( rootProject.version == '0' || rootProject.version.contains( "SNAPSHOT" ) )
{
into( "$rootProject.projectDir/../qi4j.github.com/develop/javadocs/" )
}
else
{
into( "$rootProject.projectDir/../qi4j.github.com/$version/javadocs/" )
}
from( 'build/docs/javadoc/' )
}
// Build All
task buildAll( dependsOn: [
archiveJavadocs,
test,
jar,
subprojects*.dependencyReport,
subprojects*.assemble,
':org.qi4j.manual:website'
] ) { }
// Prepare runtime dependencies download facility (metalink)
buildAll.doLast {
def runtimeDepsMetalink = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<metalink xmlns=\"urn:ietf:params:xml:ns:metalink\">\n"
runtimeDepsMetalink = runtimeDepsMetalink + " <identity>qi4j-sdk-runtime-deps</identity>\n"
runtimeDepsMetalink = runtimeDepsMetalink + " <version>${version}</version>\n"
def handledGavPaths = []
releaseApprovedProjects.each { p ->
p.configurations.runtime.allDependencies.each { dep ->
def gavpath = dep.group.replace(".","/") + "/" + dep.name + "/" + dep.version + "/" + dep.name + "-" + dep.version + ".jar"
if( !dep.group.startsWith("org.qi4j") && !handledGavPaths.contains( gavpath ) ) {
runtimeDepsMetalink = runtimeDepsMetalink + " <file name=\"${dep.group}-${dep.name}-${dep.version}.jar\">\n"
repos_urls.each { repo_url ->
runtimeDepsMetalink = runtimeDepsMetalink + " <url>" + repo_url.value + dep.group.replace(".","/") + "/" + dep.name + "/" + dep.version + "/" + dep.name + "-" + dep.version + ".jar" + "</url>\n"
}
runtimeDepsMetalink = runtimeDepsMetalink + " </file>\n\n"
handledGavPaths << gavpath
}
}
}
runtimeDepsMetalink = runtimeDepsMetalink + "</metalink>\n"
new File( buildDir.toString(), "reports" ).mkdirs()
new File( buildDir.toString(), "reports/qi4j-sdk-runtime-deps.metalink" ).text = runtimeDepsMetalink
}
def srcDistImage = copySpec {
from '.'
exclude '**/build/' // Build output
exclude '**/bin/' // Helper scripts
exclude 'derby.log' // Derby test garbage
exclude '**/*.iml' // IDEA files
exclude '**/*.ipr' // IDEA files
exclude '**/*.iws' // IDEA files
exclude '**/.idea' // IDEA files
exclude '**/out/*' // IDEA build output
exclude '**/.classpath' // Eclipse files
exclude '**/.project' // Eclipse files
exclude '**/.settings' // Eclipse files
exclude '**/.nb-gradle/' // Netbeans files
exclude '**/.nb-gradle*' // Netbeans files
exclude '**/.git/' // Git directories
exclude '**/.git*' // Git files
exclude '**/.gradle/' // Gradle management files
exclude '**/gradle.properties' // Gradle properties
exclude '**/.gradletasknamecache' // Gradle cache
into "qi4j-sdk-$version/src/"
}
def reportsDistImage = copySpec {
from "$buildDir/reports"
into( "docs/reports" )
}
def docsImage = copySpec {
from "build/docs"
from "manual/build/docs/website"
into( "docs" )
}
def runtimeDependenciesListImage = copySpec {
releaseApprovedProjects.collect { p ->
into( "libs/" ) {
from "$p.buildDir/reports/project/dependencies.txt"
rename 'dependencies.txt', p.name + '-' + p.version + '-runtime-deps.txt'
}
}
into( "libs/" ) {
from "build/reports/qi4j-sdk-runtime-deps.metalink"
rename 'qi4j-sdk-runtime-deps.metalink', 'qi4j-sdk-' + version + '-runtime-deps.metalink'
}
}
def libsImage = copySpec {
releaseApprovedProjects.collect { proj ->
into( "libs/" ) {
from proj.configurations.archives.artifacts.files
exclude '**-testsources.jar'
exclude '**-javadoc.jar'
exclude '**/*.asc'
}
}
}
def samplesImage = copySpec {
from( "$projectDir/samples" )
from( "$projectDir/samples/*/build/docs/javadoc" )
into( "samples" )
exclude '**/*.iml'
exclude '**/build/' // build output
}
def tutorialsImage = copySpec {
from( "$projectDir/tutorials" )
exclude '**/build/'
into( "tutorials" )
from( "$projectDir/tutorials/*/build/docs/javadoc" )
exclude '**/*.iml'
}
def binDistImage = copySpec {
into "qi4j-sdk-$version"
with docsImage
with reportsDistImage
with runtimeDependenciesListImage
with libsImage
with samplesImage
with tutorialsImage
}
task zipSources( type: Zip, dependsOn: [ buildAll ] ) {
baseName = 'qi4j-sdk'
with srcDistImage
classifier = 'src'
}
task tarSources( type: Tar, dependsOn: [ buildAll ] ) {
baseName = 'qi4j-sdk'
with srcDistImage
compression = Compression.GZIP
classifier = 'src'
}
task zipBinaries( type: Zip, dependsOn: [ buildAll ] ) {
baseName = 'qi4j-sdk'
classifier = 'bin'
with binDistImage
}
task tarBinaries( type: Tar, dependsOn: [ buildAll ] ) {
baseName = 'qi4j-sdk'
classifier = 'bin'
compression = Compression.GZIP
with binDistImage
}
artifacts {
archives zipSources, tarSources, zipBinaries, tarBinaries
}
task dist( type: Copy, dependsOn: install ) {
with binDistImage
into "$buildDir/dist"
}
task checkReleaseSpec {
description = "Ensure that no releasable module depend on module(s) that don't fit the release criteria."
group = 'release'
dependsOn releaseApprovedProjects*.configurations.runtime
doFirst {
def notReleasable = [:]
releaseApprovedProjects*.configurations.runtime.allDependencies.findAll({ it instanceof ProjectDependency }).each { dep ->
def depNotReleaseApproved = releaseApprovedProjects.findAll { rp ->
rp.group == dep.dependencyProject.group && rp.name == dep.dependencyProject.name
}.isEmpty()
if( depNotReleaseApproved )
{
if( !notReleasable[p] ) notReleasable[p] = []
notReleasable[p] << dep
}
}
if(!notReleasable.isEmpty()) {
def errorMessage = new StringBuilder()
errorMessage << "At least one releasable module depends on module(s) that don't fit the release criteria!\n"
errorMessage << "\tOffending module -> Non releasable dependencies\n"
notReleasable.each { k,v ->
def noRlsDeps = v.collect{d -> ':'+d.dependencyProject.group+':'+d.dependencyProject.name}
errorMessage << "\t$k -> ${noRlsDeps})\n"
}
errorMessage << "Check the dev-status.xml file content in each modules directory."
throw new GradleException( errorMessage.toString() )
}
}
}
task release {
description = 'Builds, tests and uploads the release artifacts'
group = 'release'
doFirst {
if( System.properties[ 'version' ] == null || System.properties[ 'version' ].contains( 'SNAPSHOT' ) )
{
throw new GradleException( "'version' must be given as a system property to perform a release." )
}
}
dependsOn checkReleaseSpec, archiveJavadocs, ':org.qi4j.manual:copyWebsite', allprojects*.uploadArchives, dist
}
//
// This is a task that generates the gradlew scripts, allowing users to run gradle without having gradle installed
// on their system.
// This task should be run by "build master" and the resulting ouput committed to source control. Its outputs include:
// 1) /gradlew which is the *NIX shell script for executing builds
// 2) /gradlew.bat which is the windows bat script for for executing builds
// 3) /wrapper which is a directory named by the "jarPath" config which contains other needed files.
task wrapper( type: Wrapper ) {
gradleVersion = '1.11'
}