forked from puniverse/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
511 lines (448 loc) · 19.5 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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
classpath 'net.saliman:gradle-cobertura-plugin:2.2.4'
}
}
subprojects {
apply plugin: 'java'
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
group = "co.paralleluniverse"
version = "0.6.3-SNAPSHOT"
status = "integration"
description = "lightweight threads and actors for the JVM."
ext.url = "http://puniverse.github.com/quasar"
ext.vendor = "Parallel Universe Software Co."
ext.licenseName1 = "The GNU Lesser General Public License, version 3"
ext.licenseUrl1 = "http://www.gnu.org/licenses/lgpl-3.0.txt"
ext.licenseName2 = "Eclipse Public License - v 1.0"
ext.licenseUrl2 = "http://www.eclipse.org/legal/epl-v10.html"
ext.scmUrl = "https://github.com/puniverse/quasar"
ext.scmConnection = "https://github.com/puniverse/quasar.git"
ext.distDir = "$buildDir/dist"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.baselib = "${rootProject.projectDir}/baselib"
ext.quasarJar = "${rootProject.projectDir}/quasar-core/build/libs/quasar-core-${version}.jar" // project(':quasar-core').jar.archivePath
ext.asmVer = '5.0.3'
if (!project.hasProperty("sonatypeUsername") || !project.hasProperty("sonatypePassword")) {
println "sonatype username or password not set"
ext.sonatypeUsername = ""
ext.sonatypePassword = ""
}
if (!project.hasProperty('mainClass')) { // must use project.hasProperty() rather than hasProperty in subprojects (gradle bug)
ext.mainClass = ''
}
repositories {
flatDir {
dirs baselib
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/releases" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "http://download.oracle.com/maven/" }
}
}
configurations.all {
resolutionStrategy {
failOnVersionConflict()
}
}
configurations {
compileOnly
provided
markdownDoclet
}
dependencies {
compile("io.dropwizard.metrics:metrics-core:3.1.1") {
exclude group: 'org.slf4j', module: '*'
}
provided "org.apache.ant:ant:1.9.4"
compile "com.google.guava:guava:18.0"
testCompile 'junit:junit:4.12'
testCompile('org.truth0:truth:0.23') {
exclude group: 'com.google.guava', module: 'guava'
exclude group: 'junit', module: 'junit'
}
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile("org.mockito:mockito-all:1.10.19") {
exclude group: "org.ow2.asm", module: '*'
}
testCompile "org.ow2.asm:asm:$asmVer"
testCompile 'org.openjdk.jmh:jmh-core:1.6.3'
testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.6.3'
compileOnly 'org.kohsuke.metainf-services:metainf-services:1.5'
// compileOnly 'com.google.auto.service:auto-service:1.0-rc1' // same as metainf-services
markdownDoclet "ch.raffael.pegdown-doclet:pegdown-doclet:1.1.1"
}
sourceSets {
main.compileClasspath += configurations.compileOnly
test.compileClasspath += configurations.compileOnly
main.compileClasspath += configurations.provided
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
// tasks.withType(JavaCompile) {
// // options.compilerArgs << "-Xlint:unchecked"
// // options.compilerArgs << "-Xlint:deprecation"
// }
compileJava.dependsOn processResources
compileJava {
doLast {
ant.taskdef(
name:'scanSuspendables', classname:'co.paralleluniverse.fibers.instrument.SuspendablesScanner',
classpath: "build/classes/main:build/resources/main:" + configurations.compile.asPath)
ant.scanSuspendables(
auto: false,
supersFile:"$sourceSets.main.output.resourcesDir/META-INF/suspendable-supers",
append: false) {
fileset(dir: sourceSets.main.output.classesDir)
}
ant.taskdef(name:'instrumentation', classname:'co.paralleluniverse.fibers.instrument.InstrumentationTask', classpath: "build/resources/main:build/classes/main:" + configurations.compile.asPath)
ant.instrumentation(verbose:'true', check:'true', debug:'true') {
fileset(dir: sourceSets.main.output.classesDir) {
exclude(name: 'co/paralleluniverse/fibers/instrument/*.class')
}
}
}
}
test.dependsOn jar
test {
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()
}
}
}
}
tasks.withType(Test) {
useJUnit()
// systemProperty 'co.paralleluniverse.fibers.verifyInstrumentation', 'true'
// systemProperty "java.util.logging.config.file", "jul.properties"
systemProperty "log4j.configurationFile", "${rootProject.projectDir}/log4j.xml"
// systemProperty "Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
// systemProperty 'co.paralleluniverse.debugMode', 'true'
systemProperty 'co.paralleluniverse.monitoring.flightRecorderLevel', '5'
systemProperty 'co.paralleluniverse.globalFlightRecorder', 'true'
systemProperty 'co.paralleluniverse.flightRecorderDumpFile', 'quasar.log'
systemProperty 'co.paralleluniverse.monitoring.flightRecorderSize', '200000'
jvmArgs "-javaagent:${quasarJar}" // =vdmc (verbose, debug, allow monitors, check class)
jvmArgs "-Xmx2048m"
doLast() {
println "file://" + getReports().getHtml().getDestination() + "/index.html"
}
}
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+')
}
jvmArgs '-Xmx2048m'
systemProperty "log4j.configurationFile", "${rootProject.projectDir}/log4j.xml"
systemProperty "Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
// systemProperty 'co.paralleluniverse.fibers.verifyInstrumentation', 'true'
jvmArgs "-javaagent:${quasarJar}" // =vdmc (verbose, debug, allow monitors, check class)
}
tasks.withType(JavaExec) {
classpath += sourceSets.test.runtimeClasspath
}
// tasks.withType(Debug) {
// classpath = sourceSets.test.runtimeClasspath
// }
configure (javadoc) {
options {
docletpath = configurations.markdownDoclet.files.asType(List)
doclet = 'ch.raffael.doclets.pegdown.PegdownDoclet'
addStringOption("parse-timeout", "10")
// stylesheetFile = rootProject.file('./baselib/javadoc.css')
links = [
"http://docs.oracle.com/javase/7/docs/api/",
"http://docs.guava-libraries.googlecode.com/git-history/v18.0/javadoc/"
]
}
excludes = [
"co/paralleluniverse/common/logging/**",
"co/paralleluniverse/common/monitoring/**",
"co/paralleluniverse/common/util/**",
]
}
defaultTasks 'build'
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
///////// 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
}
// remove embedded jars from pom
configure(install.repositories.mavenInstaller) {
pom.whenConfigured {
it.dependencies.removeAll { dep ->
dep.artifactId.startsWith('jsr166e') ||
dep.artifactId.startsWith('high-scale-lib')
(dep.groupId == 'co.paralleluniverse' && dep.artifactId.startsWith('quasar-core'))
}
}
}
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")) {
// User and Password are taken from ~/.gradle/gradle.properties
authentication(userName: project.sonatypeUsername, password: project.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.licenseName1
url project.licenseUrl1
distribution 'repo'
}
license {
name project.licenseName2
url project.licenseUrl2
distribution 'repo'
}
}
developers {
developer {
id 'pron'
name 'Ron Pressler'
}
}
}
}
}
}
}
project (':quasar-core') {
apply plugin: 'com.github.johnrengelman.shadow'
dependencies {
compile ":jsr166e"
compile ":high-scale-lib"
compile "org.hdrhistogram:HdrHistogram:2.1.3"
compile("org.latencyutils:LatencyUtils:2.0.2") {
exclude group: "org.hdrhistogram", module: '*'
}
compile "org.ow2.asm:asm:$asmVer"
compile "org.ow2.asm:asm-analysis:$asmVer"
compile "org.ow2.asm:asm-commons:$asmVer"
compile "org.ow2.asm:asm-util:$asmVer"
compile "com.lmax:disruptor:3.3.2"
compile("com.esotericsoftware.kryo:kryo:2.24.0") {
exclude group: "org.ow2.asm", module: '*'
}
compile("de.javakaffee:kryo-serializers:0.28") {
exclude group: "com.esotericsoftware.kryo", module: '*'
}
}
jar {
from zipTree("${baselib}/jsr166e.jar") // include non-Maven jars
from zipTree("${baselib}/high-scale-lib.jar") // include non-Maven jars
manifest {
attributes(
"Built-By" : System.getProperty("user.name"),
"Implementation-Title" : project.name,
"Implementation-Version" : version,
"Implementation-Vendor" : vendor,
"Premain-Class" : "co.paralleluniverse.fibers.instrument.JavaAgent",
"Agent-Class" : "co.paralleluniverse.fibers.instrument.JavaAgent",
"Can-Retransform-Classes" : "true",
"Can-Redefine-Classes" : "true",
// "Class-Path" : configurations.runtime.collect { "lib/"+it.getName() }.join(',')
)
}
}
shadowJar {
outputs.upToDateWhen { false }
// artifactAttached = false
classifier = 'shadow'
destinationDir = file("$buildDir/libs")
dependencies {
include(dependency('org.ow2.asm:.*:.*'))
include(dependency(':jsr166e'))
include(dependency(':high-scale-lib'))
}
relocate 'org.objectweb.asm.', 'co.paralleluniverse.asm.'
doLast {
logger.info("$buildDir/libs/${project.name}-${project.version}-${classifier}.jar -> $buildDir/libs/${project.name}-${project.version}.jar")
file("$buildDir/libs/${project.name}-${version}-${classifier}.jar").renameTo(file("$buildDir/libs/${project.name}-${project.version}.jar"))
}
}
shadowJar.dependsOn jar
build.dependsOn shadowJar
install.dependsOn shadowJar
signArchives.dependsOn shadowJar
uploadArchives.dependsOn shadowJar
def installer = install.repositories.mavenInstaller
def deployer = uploadArchives.repositories.mavenDeployer
[installer, deployer]*.pom*.whenConfigured {
it.dependencies.removeAll { dep ->
dep.artifactId.startsWith('jsr166e') ||
dep.artifactId.startsWith('high-scale-lib') ||
dep.groupId == 'org.ow2.asm' ||
(dep.groupId == 'co.paralleluniverse' && dep.artifactId.startsWith('quasar-core'))
}
}
if (System.properties['java.version'].startsWith('1.8') ) {
artifacts {
archives jar
archives project(':quasar-core-jdk8').jar
archives sourcesJar
archives javadocJar
}
install.dependsOn ':quasar-core-jdk8:shadowJar'
uploadArchives.dependsOn ':quasar-core-jdk8:shadowJar'
}
}
project (':quasar-actors') {
//project.evaluationDependsOn(':quasar-core')
dependencies {
compile project(':quasar-core')
// compile 'org.mutabilitydetector:MutabilityDetector:0.9.2'
compile "org.slf4j:slf4j-api:1.7.10"
compile "net.bytebuddy:byte-buddy:0.5.3"
// runtime "org.slf4j:slf4j-jdk14:1.7.10"
testRuntime("org.apache.logging.log4j:log4j-slf4j-impl:2.2") {
exclude group: "org.slf4j", module: '*'
}
testRuntime "org.apache.logging.log4j:log4j-api:2.2"
testRuntime "org.apache.logging.log4j:log4j-core:2.2"
testRuntime "com.lmax:disruptor:3.3.2" // required for log4j
}
}
project (':quasar-galaxy') {
dependencies {
compile project(':quasar-core')
compile project(':quasar-actors')
compile ("co.paralleluniverse:galaxy:1.4") {
exclude group: 'com.lmax', module: 'disruptor'
exclude group: 'de.javakaffee', module: 'kryo-serializers'
exclude group: 'com.google.guava', module: 'guava'
exclude group: "org.slf4j", module: '*'
}
testCompile ('org.gridkit.lab:telecontrol-ssh:0.7.24'){
exclude group: 'org.ow2.asm', module: '*'
exclude group: 'org.slf4j', module: '*'
}
testRuntime files(jar.archivePath)
}
tasks.withType(Test) {
systemProperty "co.paralleluniverse.quasarJar", "${quasarJar}"
systemProperty "jgroups.bind_addr", "127.0.0.1"
systemProperty "galaxy.multicast.address", "225.0.0.1"
systemProperty "galaxy.multicast.port", "7050"
systemProperty "co.paralleluniverse.galaxy.configFile", "${sourceSets.main.output.resourcesDir}/config/peer.xml"
systemProperty "co.paralleluniverse.galaxy.autoGoOnline", "true"
}
tasks.withType(JavaExec) {
main = mainClass
systemProperty "log4j.configurationFile", "${rootProject.projectDir}/log4j.xml"
systemProperty "Log4jContextSelector", "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector"
// systemProperty 'co.paralleluniverse.fibers.verifyInstrumentation', 'true'
// systemProperty "co.paralleluniverse.io.useJDKSerialization", "true"
jvmArgs "-javaagent:${quasarJar}" // =v, =d
jvmArgs "-ea", "-XX:MaxDirectMemorySize=100M"
systemProperty "jgroups.bind_addr", "127.0.0.1"
systemProperty "galaxy.multicast.address", "225.0.0.1"
systemProperty "galaxy.multicast.port", "7050"
systemProperty "co.paralleluniverse.galaxy.configFile", "${sourceSets.main.output.resourcesDir}/config/peer.xml"
systemProperty "co.paralleluniverse.galaxy.autoGoOnline", "true"
}
}
task javadoc(type: Javadoc, dependsOn: subprojects.javadoc) {
title = "Quasar ${project(':quasar-core').version}"
destinationDir = file("docs/javadoc")
source = project(':quasar-core').sourceSets.main.allJava + project(':quasar-actors').sourceSets.main.allJava
classpath = files(subprojects.collect { project -> project.sourceSets.main.compileClasspath })
options {
docletpath = project(':quasar-core').configurations.markdownDoclet.files.asType(List)
doclet = 'ch.raffael.doclets.pegdown.PegdownDoclet'
addStringOption("parse-timeout", "10")
// stylesheetFile = rootProject.file('./baselib/javadoc.css')
links = [
"http://docs.oracle.com/javase/7/docs/api/",
"http://docs.guava-libraries.googlecode.com/git-history/v18.0/javadoc/"
]
}
excludes = [
"co/paralleluniverse/actors/spi/**",
"co/paralleluniverse/actors/ActorMonitor.java",
"co/paralleluniverse/actors/GlobalRegistry.java",
"co/paralleluniverse/actors/JMXActorMonitor.java",
"co/paralleluniverse/actors/LifecycleListener.java",
"co/paralleluniverse/actors/LifecycleListenerProxy.java",
"co/paralleluniverse/actors/MutabilityTester.java",
"co/paralleluniverse/actors/RemoteActorProxyFactoryService.java",
"co/paralleluniverse/actors/RemoteActorRef.java",
"co/paralleluniverse/actors/RemoteActorProxyFactory.java",
"co/paralleluniverse/common/benchmark/**",
"co/paralleluniverse/common/classloader/**",
"co/paralleluniverse/common/logging/**",
"co/paralleluniverse/common/monitoring/**",
"co/paralleluniverse/common/reflection/**",
"co/paralleluniverse/common/util/**",
"co/paralleluniverse/concurrent/forkjoin/**",
"co/paralleluniverse/concurrent/util/**",
"co/paralleluniverse/data/record/DynamicGeneratedRecord.java",
"co/paralleluniverse/data/record/DynamicRecord.java",
"co/paralleluniverse/fibers/DefaultFiberPool.java",
"co/paralleluniverse/fibers/FibersMonitor.java",
"co/paralleluniverse/fibers/FiberTimedScheduler.java",
"co/paralleluniverse/fibers/Instrumented.java",
"co/paralleluniverse/fibers/NoopFibersMonitor.java",
"co/paralleluniverse/fibers/instrument/**",
"co/paralleluniverse/io/serialization/**",
"co/paralleluniverse/remote/**",
"co/paralleluniverse/strands/channels/SelectActionImpl.java",
"co/paralleluniverse/strands/channels/disruptor/**", // not ready
"co/paralleluniverse/strands/queues/**",
]
}
task clean(dependsOn: subprojects.clean) << {
delete 'docs/javadoc'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}