forked from GPars/GPars
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
489 lines (443 loc) · 17.9 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
// GPars – Groovy Parallel Systems
//
// Copyright © 2008–2018 The original author or authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Author: Václav Pech
// Author: Russel Winder
// Author: Dierk König
// Author: Hans Dockter
// Author: Rene Groeschke
// Author: Hamlet D'Arcy - Updated OSGi configuration
// Author: Schalk W. Cronjé
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.asciidoctor:asciidoctorj-pdf:${gpars_ascidoctorjPDFVersion}"
}
}
plugins {
// TODO: Cannot use anything other than literals here. Why?
id 'org.asciidoctor.convert' version '1.5.8'
id 'com.jfrog.bintray' version '1.8.1'
id 'com.jfrog.artifactory' version '4.7.3'
}
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'osgi'
apply plugin: 'eclipse'
apply plugin: 'idea'
import org.apache.tools.ant.taskdefs.Javadoc
group = 'org.gpars'
archivesBaseName = 'gpars'
defaultTasks 'test'
sourceCompatibility = 8
targetCompatibility = 8
ext {
theVendor = 'gpars.org'
theTitle = 'GPars: Groovy Parallel Systems'
titleForDocumentation = archivesBaseName + ' ' + version
copyrightString = 'Copyright © 2008–2018 Václav Pech. All Rights Reserved.'
packageTitle = group
description = 'The Groovy and Java high-level concurrency library offering actors, dataflow, CSP, agents, parallel collections, fork/join and more'
}
repositories {
if (gpars_useMavenLocal) { mavenLocal() }
jcenter()
mavenCentral()
}
configurations {
deployerJars
docs
cover
groovyDoc // Hack due to problem with groovydoc process in Gradle.
}
dependencies {
compile "org.codehaus.groovy:groovy:${gpars_groovyVersion}"
compile "org.codehaus.groovy:groovy-cli-commons:${gpars_groovyVersion}"
compile "org.multiverse:multiverse-core:${gpars_multiverseVersion}", { transitive = false }
compile "io.netty:netty-all:${gpars_nettyVersion}"
compile "cspforjava:jcsp:${gpars_jcspVersion}"
testCompile "org.spockframework:spock-core:${gpars_spockVersion}"
testCompile "com.google.code.gson:gson:${gpars_gsonVersion}"
testCompile "com.google.guava:guava:${gpars_guavaVersion}"
testCompile fileTree(dir: 'lib', include: '*.jar')
deployerJars "org.apache.maven.wagon:wagon-http-lightweight:${gpars_wagonhttplightweightVersion}"
cover "net.sourceforge.cobertura:cobertura:${gpars_coberturaVersion}"
testRuntime "net.sourceforge.cobertura:cobertura:${gpars_coberturaVersion}"
// Have to get some specific dependencies into the GroovyDoc process.
groovyDoc "org.codehaus.groovy:groovy:${gpars_groovyVersion}"
groovyDoc "org.fusesource.jansi:jansi:${gpars_jansiVersion}"
}
task copyDSLDefinitions(type: Copy) {
into "$buildDir/classes/main"
from(sourceSets.main.allSource) { include('**/*.gdsl') }
}
jar {
manifest {
name = 'gpars'
version = this.version
symbolicName = 'gpars.org'
instruction 'Bundle-Vendor', theVendor
instruction 'Bundle-Description', group
instruction 'Bundle-DocURL', 'http://gpars.codehaus.org'
instruction 'Built-By', System.properties.'user.name'
instruction 'Extension-Name', archivesBaseName
instruction 'Specification-Title', theTitle
instruction 'Specification-Version', version
instruction 'Specification-Vendor', theVendor
instruction 'Implementation-Title', theTitle
instruction 'Implementation-Version', version
instruction 'Implementation-Vendor', theVendor
instruction 'provider', theVendor
instruction 'Export-Package', "*;version=${version}"
instruction 'Import-Package', '*;resolution:=optional'
instruction '-removeheaders', 'Bnd-LastModified'
}
dependsOn copyDSLDefinitions
}
task runBenchmarks(type: JavaExec) {
description = 'Runs benchmarks measuring the throughput and latency of actors in GPars'
main = 'groovyx.gpars.benchmark.caliper.BenchmarkRunner'
classpath = sourceSets.test.runtimeClasspath
def gcArg = "-XX:+UseParallelGC"
// On Windows, calling the JVM with extended params requires multiple levels of quoting
if (System.getProperty('os.name').matches(".*Windows.*")) {
gcArg = '"""-XX:+UseParallelGC"""'
}
args = ["-Jgc=${gcArg}", '-Jxms=-Xms512M', '-Jxmx=-Xmx1024M', '-Jserver=-server']
}
// To get the details of the "unchecked" issues.
compileGroovy.options.compilerArgs = ['-Xlint']
[compileGroovy, compileTestGroovy]*.groovyOptions*.fork(memoryInitialSize: '128M', memoryMaximumSize: '512M')
task withCoverage { // only here such that it can be put on the command line for enabling coverage
description = 'Prepare the test task to use code coverage if needed.'
}
test {
forkEvery = 600
maxParallelForks = hasProperty('gpars_maxTestForks') ? gpars_maxTestForks : 1
exclude '**/integration/**/*.*'
}
task integrationTest(type: Test, dependsOn: 'test') {
include '**/integration/**/*.*'
}
// codenarc configuration
tasks.withType(CodeNarc).all { codeNarcTask ->
codeNarcTask.configFile = file('./config/codenarc/codenarc.groovy')
codeNarcTask.ignoreFailures = true
}
project.tasks.install.repositories.mavenInstaller.pom.with {
project {
name 'GPars'
description ext.description
url 'http://gpars.github.io'
inceptionYear '2008'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
whenConfigured { pom ->
// dependency is a native Maven dependency object (With properties artifactId, groupId, ...)
pom.dependencies.each { dependency ->
if (dependency.artifactId in ['netty-all', 'jcsp', 'multiverse', 'groovy-all']) {
dependency.optional = true
}
}
// Remove test dependencies from all poms
pom.dependencies.removeAll(pom.dependencies.findAll { it.scope == 'test' })
}
}
javadoc {
options.overview('overview.html')
options.showAll()
options.encoding('UTF-8')
options.setUse(true)
options.author(true)
options.version(true)
options.windowTitle(titleForDocumentation)
options.docTitle(titleForDocumentation)
options.footer(copyrightString)
doFirst {
javadoc.title = titleForDocumentation
javadoc.options.docTitle = javadoc.title
}
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
//noinspection SpellCheckingInspection
options.addStringOption('Xdoclint:none', '-quiet')
}
}
groovydoc {
groovyClasspath = configurations.groovyDoc // Hack, we shouldn't have to do this.
dependsOn(classes)
includePrivate = true
use = true
windowTitle = packageTitle
docTitle = packageTitle
header = packageTitle
footer = copyrightString
include 'groovyx/gpars/**'
overviewText = project.resources.text.fromFile('overview.html')
}
asciidoctor {
sources {
include 'index.adoc', 'quick_reference.adoc'
}
backends 'html5','pdf'
attributes toc: 'left',
doctype: 'book',
icons: 'font',
sectlink: true,
sectanchors: true,
numbered: true,
linkattrs: true,
imagesdir: 'images',
'source-highlighter': 'coderay',
stylesheet: 'css/style.css',
'pdf-stylesdir': 'theme',
'pdf-fontsdir': 'fonts',
'pdf-style': 'gpars'
}
task jarDoc(type: Jar, dependsOn: [javadoc, groovydoc]) {
classifier = 'javadoc'
from docsDir
}
task jarSrc(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives(jarSrc)
archives(jarDoc)
}
task zipGuide(type: Zip, dependsOn: asciidoctor) {
appendix = 'guide'
from(buildDir.name + '/asciidoc')
}
task zipSamples(type: Zip) {
appendix = 'samples'
from sourceSets.test.allSource.matching {
include 'groovyx/gpars/samples/**'
}
}
task zipJavaDemo(type: Zip) {
appendix = 'mvn-java-demo'
from('java-demo'){
include 'src/**'
include 'pom.xml'
}
}
task zipDist(type: Zip) {
from jar.outputs.files
from(sourceSets.main.runtimeClasspath){
include('netty*', 'multiverse*')
}
from('licenses'){
include '*'
into 'licenses'
}
from('src/main/resources/META-INF/'){
include('LICENSE.txt', 'NOTICE.txt')
}
appendix = 'all'
}
publishing {
publications {
gParsPublish(MavenPublication) {
artifactId 'gpars'
from components.java
artifact jarDoc {
classifier = 'javadoc'
}
artifact jarSrc {
classifier = 'sources'
}
artifact zipGuide {
classifier = 'guide'
}
artifact zipSamples {
classifier = 'samples'
}
artifact zipJavaDemo {
classifier = 'mvn-java-demo'
}
artifact zipDist {
classifier = 'all'
}
}
}
}
// TODO: Activate signing to bintray
// TODO: Activate sync to Maven Central
bintray {
user = project.properties.gpars_bintrayUser
key = project.properties.gpars_bintrayKey
publish = false
dryRun = false
configurations = ['archives']
pkg {
userOrg = 'gpars'
repo = 'maven'
name = 'gpars'
desc = project.description
labels = ['groovy','gpars']
publicDownloadNumbers = true
websiteUrl = 'http://gpars.org'
issueTrackerUrl = 'https://github.com/GPars/GPars/issues'
vcsUrl = 'https://github.com/GPars/GPars.git'
licenses = ['Apache-2.0']
version {
name = project.version
vcsTag = "v${project.version}"
gpg {
sign = false
passphrase = project.properties.bintrayGpgPassphrase
}
// mavenCentralSync {
// sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
// user = 'userToken' //OSS user token
// password = 'paasword' //OSS user password
// close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually.
// }
}
}
}
bintrayUpload {
dependsOn build, jarDoc, jarSrc
onlyIf{project.properties.gpars_bintrayUser && project.properties.gpars_bintrayKey && !version.contains('SNAPSHOT')}
}
artifactory {
publish {
contextUrl = 'http://oss.jfrog.org'
repository {
repoKey = 'oss-snapshot-local'
username = project.properties.gpars_bintrayUser
password = project.properties.gpars_bintrayKey
}
}
}
artifactoryPublish {
dependsOn 'generatePomFileForGParsPublishPublication'
publications(publishing.publications.gParsPublish)
onlyIf{project.properties.gpars_bintrayUser && project.properties.gpars_bintrayKey && version.contains('SNAPSHOT')}
}
task release(dependsOn: ['build', 'jarSrc', 'jarDoc', 'zipSamples', 'zipJavaDemo', 'zipDist', 'zipGuide']) << {
println 'We release now'
}
task demo(type: DemoTask, dependsOn: 'compileGroovy') {
excludedDemos = [
'DemoPotentialDeadlock', // may deadlock (on purpose)
'DemoNonDeterministicDeadlockWithDataflows', // may deadlock (on purpose)
'DemoDeadLock', // deadlock (on purpose)
'DemoRemote', // doesn't work in an automated environment
'DemoSwing', // maybe we don't want these to run on the CI ..
'DemoSwingMashup', // but they can be run locally
'DemoSwingCollectionProcessing',
'DemoSwingActors',
'DemoSwingDataflowOperators',
'DemoSwingFancyDataflow', // Shows UI
'DemoSwingDataflowProgress', // Shows UI
'DataflowDemo4', // Never stops
'DemoWebPageProcessing', // Never stops
'DemoWebPageProcessingWithCaching', // Never stops
'DemoMapReduce', // Relies on internet connection
'DemoNumbers', //Never stops
'FibonacciV1', //Never stops
'FibonacciV2', //Never stops
'DemoSieveEratosthenesCSP', //Never stops
'DemoSieveEratosthenesTheGoWay', //Never stops
'DemoSieveEratosthenesTheGoWayWithOperators', //Never stops
'DemoThreading', //Never stops
'DemoProducerConsumer1', //Never stops
'DemoPhysicalCalculations', //Needs user input
'DemoFibonacci1', //Needs classes from its source folder
'DemoFibonacci1WithSynchronousChannels', //Needs classes from its source folder
'DemoFibonacci2', //Needs classes from its source folder
'DemoFibonacci2WithSynchronousChannels', //Needs classes from its source folder
'DemoNumbers', //Needs classes from its source folder
'DemoNumbersWithSynchronousChannels', //Needs classes from its source folder
'DemoActor_4_4', //Specifies absolute paths
'RunReset', //Starts UI
'DemoSwingMergeSort', //Starts UI
'DemoVisualForkJoinMergeSort', //Starts UI
'DemoStm', //Stm
'DemoDirectStm', //Stm
'DemoRetry', //Stm
'DemoCustomBlocks', //Stm
'DemoLifeWithDataflowOperators', //Interacts with the user
'DemoSwingLifeWithDataflowOperators', //Interacts with the user
'DemoSwingLifeWithActors', //Interacts with the user
'DemoSwingLifeWithActiveObjects', //Interacts with the user
'DemoSwingLifeWithAsyncFunctions', //Interacts with the user
'DemoReplyCompileStatic', //Weird compile static issue
'DemoFibonacciWithSingleOperatorCompileStatic', //Weird compile static issue
]
classpath = sourceSets.main.runtimeClasspath
demoFiles = sourceSets.test.allGroovy.matching {
include '**/*Demo*.groovy'
exclude excludedDemos.collect { name -> "**/${name}.groovy".toString() }
}
}
idea {
module {
excludeDirs += file('gradle/') // Gradle directory including the wrapper subdirectory.
excludeDirs += file('.settings/') // Eclipse settings directory.
excludeDirs += file('bin') // Eclipse compilation directory.
excludeDirs += file('out') // IDEA compilation directory.
excludeDirs += file('build') // Gradle compilation directory.
excludeDirs += file('docs') // Jon's book directory
excludeDirs += file('java-demo') // A separate module of a pure-java gpars usage
}
project {
jdkName '1.8'
languageLevel 'JDK_1_8'
ipr {
withXml { provider ->
def node = provider.asNode()
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
vcsConfig.mapping[0].'@vcs' = 'Git'
//Copy the inspection profiles as well as the spell-checker's dictionaries from the default project file
def inspectionConfig = provider.asNode().component.find {
it.'@name' == 'InspectionProjectProfileManager'
}
if (inspectionConfig) node.remove(inspectionConfig)
def dictionaryConfig = provider.asNode().component.find { it.'@name' == 'ProjectDictionaryState' }
if (dictionaryConfig) node.remove(dictionaryConfig)
new File('GPars_CI_only.ipr').withReader { reader ->
def project = new XmlParser().parse(reader)
def inspections = project.component.find { it.'@name' == 'InspectionProjectProfileManager' }
node.append(inspections)
def dictionaries = project.component.find { it.'@name' == 'ProjectDictionaryState' }
node.append(dictionaries)
}
def gradleSettings = node.appendNode('component', [name: 'GradleSettings'])
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir.absolutePath])
}
}
}
}
// TODO: WTF is happening with coverage?
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(':test') && taskGraph.hasTask(':withCoverage')) {
new Coverage(this).setup()
}
}