Skip to content

Instantly share code, notes, and snippets.

@smaldini
Created September 6, 2014 09:42
Show Gist options
  • Save smaldini/95cdf602e94b68b9dee0 to your computer and use it in GitHub Desktop.
Save smaldini/95cdf602e94b68b9dee0 to your computer and use it in GitHub Desktop.
/*
* Copyright (c) 2011-2013 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.
*/
description = 'Reactive fast data framework for the JVM'
ext {
gradleVersion = '1.12'
gradleScriptDir = "${rootProject.projectDir}/gradle"
// Languages
groovyVersion = '2.3.6'
// Logging
slf4jVersion = '1.7.7'
logbackVersion = '1.1.2'
// Libraries
disruptorVersion = '3.2.1'
gsCollectionsVersion = '5.1.0'
nettyVersion = '4.0.20.Final'
jeromqVersion = '0.3.4'
jacksonDatabindVersion = '2.4.1.1'
jsonPathVersion = '0.9.1'
kryoVersion = '2.24.0'
protobufVersion = '2.5.0'
snappyVersion = '1.1.0.1'
hadoopVersion = '1.1.2'
openHftChronicleVersion = '2.0.3'
openHftLangVersion = '6.1.4'
// Testing
mockitoVersion = '1.9.5'
spockVersion = '0.7-groovy-2.0'
// Code coverage
jacocoVersion = '0.7.0.201403182114'
javadocLinks = [
"http://docs.oracle.com/javase/7/docs/api/",
"http://docs.oracle.com/javaee/6/api/",
"http://fasterxml.github.com/jackson-core/javadoc/2.4.1.1/",
"http://www.goldmansachs.com/gs-collections/javadoc/5.1.0/"
] as String[]
}
buildscript {
repositories {
maven { url "http://repo.spring.io/plugins-release" }
jcenter()
}
dependencies {
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.6',
'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE',
'com.github.jengelman.gradle.plugins:shadow:1.1.1'
}
}
apply from: "$gradleScriptDir/setup.gradle"
configure(allprojects) { project ->
group = 'org.projectreactor'
apply plugin: 'propdeps'
apply plugin: 'java'
apply from: "${gradleScriptDir}/ide.gradle"
[compileJava, compileTestJava]*.options*.compilerArgs = [
"-Xlint:varargs",
"-Xlint:cast",
"-Xlint:classfile",
"-Xlint:dep-ann",
"-Xlint:divzero",
"-Xlint:empty",
"-Xlint:finally",
"-Xlint:overrides",
"-Xlint:path",
"-Xlint:processing",
"-Xlint:static",
"-Xlint:try",
"-Xlint:deprecation",
"-Xlint:unchecked",
"-Xlint:-serial", // intentionally disabled
"-Xlint:-options", // intentionally disabled
"-Xlint:-fallthrough", // intentionally disabled
"-Xlint:-rawtypes" // TODO enable and fix warnings
]
compileGroovy {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
sourceSets.test.resources.srcDirs = ["src/test/resources", "src/test/java"]
configurations {
jacoco
}
configurations.all {
exclude group: 'commons-logging', module: 'commons-logging'
//exclude module: 'junit'
}
project.tasks.withType(Test).all {
systemProperty("java.awt.headless", "true")
systemProperty("testGroups", project.properties.get("testGroups"))
scanForTestClasses = false
include '**/*Tests.*'
include '**/*Spec.*'
exclude '**/*Abstract*.*'
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'http://repo.akka.io/snapshots/' }
maven { url 'http://repo.spring.io/libs-milestone' }
}
// dependencies that are common across all java projects
dependencies {
// Logging
compile "org.slf4j:slf4j-api:$slf4jVersion"
// JSR-305 annotations
optional "com.google.code.findbugs:jsr305:2.0.0"
// Groovy
testCompile "org.codehaus.groovy:groovy-all:$groovyVersion"
// Testing
testCompile "org.spockframework:spock-core:$spockVersion",
"org.hamcrest:hamcrest-library:1.3"
testCompile "org.testng:testng:6.8.5"
testRuntime "ch.qos.logback:logback-classic:$logbackVersion"
// Code coverage
jacoco "org.jacoco:org.jacoco.agent:$jacocoVersion:runtime"
}
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
compileTestJava.options.compilerArgs += "-parameters"
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
configure(subprojects) { subproject ->
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
repositories {
maven { url 'http://repo.spring.io/libs-snapshot' }
}
dependencies {
springIoVersions "io.spring.platform:platform-versions:$platformVersion@properties"
}
}
test {
testLogging {
jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=reactor.*"
events "failed"
exceptionFormat "full"
}
}
}
configure(rootProject) {
description = "Reactor"
configurations.archives.artifacts.clear()
task api(type: Javadoc) {
group = "Documentation"
description = "Generates aggregated Javadoc API documentation."
title = "${rootProject.description} ${version} API"
dependsOn {
subprojects.collect {
it.tasks.getByName("jar")
}
}
options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED
options.author = true
options.header = rootProject.description
options.overview = "src/api/overview.html"
options.stylesheetFile = file("src/api/stylesheet.css")
options.links(project.ext.javadocLinks)
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
maxMemory = "1024m"
destinationDir = new File(buildDir, "api")
doFirst {
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
}
}
}
project('reactor-core') {
description = 'Core Reactor components'
apply plugin: 'osgi'
apply plugin: 'groovy'
ext.bundleImportPackages = [
'net.openhft.chronicle;resolution:=optional',
'net.openhft.chronicle.tools;resolution:=optional',
'com.fasterxml.jackson.core;resolution:=optional',
'com.fasterxml.jackson.databind;resolution:=optional',
'com.fasterxml.jackson.databind.node;resolution:=optional',
'com.fasterxml.jackson.databind.type;resolution:=optional',
'com.jayway.jsonpath;resolution:=optional',
'com.jayway.jsonpath.internal;resolution:=optional',
'com.jayway.jsonpath.spi;resolution:=optional',
'org.slf4j;version="[1.5.4,2)"',
'*'
]
configurations {
jsr166e
disruptor
jarjar
}
task jsr166eRepackJar(type: Jar) { repackJar ->
repackJar.baseName = "reactor-jsr166e-repack"
repackJar.version = '1.0'
doLast() {
project.ant {
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask",
classpath: configurations.jarjar.asPath
jarjar(destfile: repackJar.archivePath) {
configurations.jsr166e.each { originalJar ->
zipfileset(src: originalJar)
}
rule(pattern: "jsr166e.**", result: "reactor.jarjrar.jsr166e.@1")
}
}
}
}
task disruptorRepackJar(type: Jar) { repackJar ->
repackJar.baseName = "reactor-disruptor-repack"
repackJar.version = disruptorVersion
doLast() {
project.ant {
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask",
classpath: configurations.jarjar.asPath
jarjar(destfile: repackJar.archivePath) {
configurations.disruptor.each { originalJar ->
zipfileset(src: originalJar)
}
rule(pattern: "com.lmax.disruptor.**", result: "reactor.jarjrarcom.lmax.disruptor.@1")
}
}
}
}
dependencies {
jarjar("com.googlecode.jarjar:jarjar:1.3")
// High-speed Dispatching
disruptor "com.lmax:disruptor:$disruptorVersion@jar"
compile(files(disruptorRepackJar))
jsr166e "io.gatling:jsr166e:1.0@jar"
compile(files(jsr166eRepackJar))
// Rich Collections
compile "com.goldmansachs:gs-collections:$gsCollectionsVersion"
// Reactive Streams
compile "org.reactivestreams:reactive-streams:0.4.0.M2"
testCompile "org.reactivestreams:reactive-streams-tck:0.4.0.M2"
// High-speed Messaging
optional "net.openhft:chronicle:$openHftChronicleVersion",
"net.openhft:lang:$openHftLangVersion"
// JSON handling
optional "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion",
"com.jayway.jsonpath:json-path:$jsonPathVersion"
// Serialization
optional "com.esotericsoftware.kryo:kryo:$kryoVersion",
"com.google.protobuf:protobuf-java:$protobufVersion",
"org.xerial.snappy:snappy-java:$snappyVersion"
}
task testNG(type: Test) {
useTestNG()
}
test {
dependsOn jar
classpath = project.sourceSets.test.runtimeClasspath +
files(jsr166eRepackJar) +
files(disruptorRepackJar)
dependsOn testNG
}
jar {
manifest {
instruction 'Import-Package', bundleImportPackages.join(',')
}
dependsOn jsr166eRepackJar
from(zipTree(jsr166eRepackJar.archivePath)) {
include "jsr166e/**"
}
dependsOn disruptorRepackJar
from(zipTree(disruptorRepackJar.archivePath)) {
include "com/lmax/disruptor/**"
}
}
}
project('reactor-groovy-extensions') {
description = 'Reactor Groovy Ext components'
apply plugin: 'osgi'
apply plugin: 'groovy'
sonarRunner {
sonarProperties {
property "sonar.language", "grvy"
}
}
dependencies {
compile project(':reactor-core'),
"org.codehaus.groovy:groovy:$groovyVersion"
}
}
project('reactor-groovy') {
description = 'Reactor Groovy components'
apply plugin: 'osgi'
apply plugin: 'groovy'
sonarRunner {
sonarProperties {
property "sonar.language", "grvy"
}
}
dependencies {
compile(files(project(":reactor-core").disruptorRepackJar))
compile(files(project(":reactor-core").jsr166eRepackJar))
compile project(':reactor-core'),
project(':reactor-groovy-extensions'),
"org.codehaus.groovy:groovy:$groovyVersion"
}
}
project('reactor-logback') {
description = 'Async Logback appender implementation'
apply plugin: 'application'
apply plugin: 'com.github.johnrengelman.shadow'
mainClassName = "reactor.logback.DurableLogUtility"
ext.baseName = "${archivesBaseName}-${version}"
dependencies {
compile(files(project(":reactor-core").disruptorRepackJar))
compile project(':reactor-core'),
"ch.qos.logback:logback-classic:$logbackVersion",
"net.openhft:chronicle:$openHftChronicleVersion",
"commons-cli:commons-cli:1.2"
}
shadowJar {
dependencies {
include(dependency("net.openhft:chronicle:$openHftChronicleVersion"))
include(dependency("commons-cli:commons-cli:1.2"))
//include(project(":reactor-core"))
}
}
}
project('reactor-net') {
description = 'Reactor TCP components'
apply plugin: 'osgi'
ext.bundleImportPackages = [
'org.zeromq;resolution:=optional',
'com.fasterxml.jackson.core;resolution:=optional',
'com.fasterxml.jackson.databind;resolution:=optional',
'com.fasterxml.jackson.module;resolution:=optional',
'*'
]
dependencies {
compile project(':reactor-core')
compile(files(project(":reactor-core").disruptorRepackJar))
compile "io.netty:netty-all:$nettyVersion"
optional "org.zeromq:jeromq:$jeromqVersion",
"com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
// Testing
testCompile "org.apache.hadoop:hadoop-client:$hadoopVersion",
"com.esotericsoftware.kryo:kryo:$kryoVersion"
testRuntime project(':reactor-logback'),
"org.slf4j:jcl-over-slf4j:$slf4jVersion"
}
jar {
manifest {
instruction 'Import-Package', bundleImportPackages.join(',')
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment