2014-11-02 17:29:45 +00:00
|
|
|
//
|
|
|
|
// Primary gradle file for building and testing redstorm
|
|
|
|
//
|
2015-08-17 18:07:55 +00:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
}
|
2014-10-22 16:59:42 +00:00
|
|
|
|
2015-08-17 18:07:55 +00:00
|
|
|
dependencies {
|
|
|
|
classpath 'com.github.jruby-gradle:jruby-gradle-jar-plugin:1.0.3'
|
|
|
|
classpath 'com.github.jruby-gradle:jruby-gradle-plugin:1.0.3'
|
|
|
|
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2"
|
|
|
|
}
|
2014-10-20 21:18:55 +00:00
|
|
|
}
|
2014-10-22 16:59:42 +00:00
|
|
|
|
2015-09-09 20:12:53 +00:00
|
|
|
apply plugin: 'idea'
|
2014-10-20 21:18:55 +00:00
|
|
|
apply plugin: 'maven'
|
|
|
|
apply plugin: 'java'
|
2015-08-17 18:07:55 +00:00
|
|
|
apply plugin: 'com.github.jruby-gradle.jar'
|
|
|
|
apply plugin: 'com.jfrog.bintray'
|
2014-10-20 21:18:55 +00:00
|
|
|
|
2015-09-11 17:53:21 +00:00
|
|
|
version = '0.9.1'
|
2014-10-22 16:59:42 +00:00
|
|
|
group = 'com.github.jruby-gradle'
|
2015-08-17 18:14:09 +00:00
|
|
|
description = "RedStorm integrates Ruby code via JRuby into the Storm distributed computation system"
|
|
|
|
defaultTasks 'check', 'assemble'
|
2014-10-21 22:49:18 +00:00
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
// Any time we're not expicitly saying "build me a release build" we'll change
|
|
|
|
// the version to -SNAPSHOT
|
2015-08-17 18:07:55 +00:00
|
|
|
if (!(System.env.TRAVIS_TAG as Boolean)) {
|
2014-10-22 16:59:42 +00:00
|
|
|
version = "${version}-SNAPSHOT"
|
|
|
|
}
|
|
|
|
|
2014-10-20 21:18:55 +00:00
|
|
|
import com.github.jrubygradle.JRubyExec
|
|
|
|
|
2015-08-17 18:07:55 +00:00
|
|
|
jruby {
|
|
|
|
/* jrubyVersion defined in gradle.properties */
|
|
|
|
defaultVersion jrubyVersion
|
|
|
|
execVersion jrubyVersion
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
|
|
|
|
// These two repositories are for storm dependencies
|
|
|
|
maven { url 'http://clojars.org/repo/' }
|
|
|
|
maven { url 'http://conjars.org/repo/' }
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
// We don't need to include storm-core in the runtime dependencies for the
|
|
|
|
// redstorm.jar since it's provided by the storm cluster this code runs on top of
|
|
|
|
runtime.exclude module: 'storm-core'
|
|
|
|
|
|
|
|
// Make sure that any task using the jrubyExec configuration inherits the
|
|
|
|
// dependencies enumerated in the `compile` configuration
|
|
|
|
jrubyExec.extendsFrom compile
|
|
|
|
}
|
|
|
|
|
2014-10-20 21:18:55 +00:00
|
|
|
dependencies {
|
2014-11-02 17:29:45 +00:00
|
|
|
// These compile dependencies are required just to compile our Java-based
|
|
|
|
// redstorm code
|
2015-08-17 18:07:55 +00:00
|
|
|
compile 'com.github.jnr:jffi:[1.2.7,1.3)'
|
|
|
|
compile 'org.apache.storm:storm-core:0.9.2-incubating'
|
|
|
|
// We don't yet support JRuby 9k so we'll limit ourselfs to the 1.7.x
|
|
|
|
compile "org.jruby:jruby-complete:[1.7.20,1.8)"
|
2014-10-20 21:43:58 +00:00
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
// Gem dependencies needed to run our Ruby development tasks like 'spec'
|
2015-08-17 18:07:55 +00:00
|
|
|
jrubyExec 'rubygems:rspec:2.99.0+'
|
|
|
|
jrubyExec 'rubygems:coveralls:0.6.7+'
|
2014-10-20 21:18:55 +00:00
|
|
|
}
|
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// DEVELOPMENT TASKS
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2014-10-20 21:18:55 +00:00
|
|
|
|
|
|
|
task compileRedstormJRuby(type: JRubyExec) {
|
2014-11-15 17:24:51 +00:00
|
|
|
def generatedDir = file("${buildDir}/generated/java")
|
|
|
|
|
2014-10-20 21:18:55 +00:00
|
|
|
group 'build'
|
|
|
|
description "Compile the right Ruby files to Java files for compilation"
|
2014-11-15 17:24:51 +00:00
|
|
|
inputs.dir('lib/red_storm')
|
|
|
|
outputs.dir(generatedDir)
|
|
|
|
|
2014-10-20 21:18:55 +00:00
|
|
|
workingDir 'lib/red_storm'
|
|
|
|
script 'jrubyc'
|
|
|
|
scriptArgs '--prefix', 'red_storm',
|
|
|
|
'--java',
|
2014-11-15 17:24:51 +00:00
|
|
|
'--target', generatedDir.absolutePath,
|
2014-10-20 21:18:55 +00:00
|
|
|
'topology_launcher.rb'
|
|
|
|
|
2014-11-15 17:24:51 +00:00
|
|
|
doFirst {
|
|
|
|
generatedDir.mkdirs()
|
|
|
|
}
|
2014-10-20 21:18:55 +00:00
|
|
|
}
|
2014-11-02 17:29:45 +00:00
|
|
|
// Chain our compileJava task off of the Ruby compilation task, this makes sure
|
|
|
|
// we are rebuilding the generated Java code from our Ruby files every time we
|
|
|
|
// need to rebuild the jar/recompile
|
2014-10-20 21:18:55 +00:00
|
|
|
project.compileJava.dependsOn compileRedstormJRuby
|
|
|
|
|
2014-10-20 21:43:58 +00:00
|
|
|
task spec(type: JRubyExec) {
|
|
|
|
group 'JRuby'
|
|
|
|
description 'Run the RSpec examples'
|
|
|
|
script 'rspec'
|
2015-08-17 18:07:55 +00:00
|
|
|
dependsOn compileJava
|
2014-10-20 21:43:58 +00:00
|
|
|
}
|
2015-08-17 18:07:55 +00:00
|
|
|
check.dependsOn spec
|
2014-10-20 21:43:58 +00:00
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2014-10-20 21:43:58 +00:00
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
sourceSets {
|
2015-08-17 18:07:55 +00:00
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDirs "src/main",
|
|
|
|
"${buildDir}/generated/java"
|
|
|
|
}
|
2014-11-02 17:29:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-17 18:14:09 +00:00
|
|
|
/* Needed, according to @ysb33r to make sure we build against JDK7 */
|
|
|
|
plugins.withType(JavaPlugin) {
|
|
|
|
sourceCompatibility = 1.7
|
|
|
|
targetCompatibility = 1.7
|
|
|
|
|
|
|
|
|
|
|
|
project.tasks.withType(JavaCompile) { task ->
|
|
|
|
task.sourceCompatibility = project.sourceCompatibility
|
|
|
|
task.targetCompatibility = project.targetCompatibility
|
|
|
|
}
|
|
|
|
|
|
|
|
project.tasks.withType(GroovyCompile) { task ->
|
|
|
|
task.sourceCompatibility = project.sourceCompatibility
|
|
|
|
task.targetCompatibility = project.targetCompatibility
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
// In addition to all of the compiled java sources, we need to include the Ruby
|
|
|
|
// code from ./lib in the .jar archive
|
2014-10-22 16:59:42 +00:00
|
|
|
jar {
|
|
|
|
from 'lib'
|
|
|
|
}
|
|
|
|
|
2014-11-02 17:29:45 +00:00
|
|
|
// Make sure we're created a sources jar to be published to jcenter
|
2014-10-22 16:59:42 +00:00
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
|
|
classifier = 'sources'
|
|
|
|
from sourceSets.main.allSource
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
archives sourcesJar
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bintray {
|
|
|
|
user = project.bintrayUser
|
|
|
|
key = project.bintrayKey
|
|
|
|
publish = true
|
|
|
|
configurations = ['archives']
|
2015-08-17 18:14:09 +00:00
|
|
|
/*
|
|
|
|
* Only only publish when we're tagging a release and if we've executed on
|
|
|
|
* the JDK7 build. This is to prevent multiple attempts by the build matrix
|
|
|
|
* to publish the artifacts
|
|
|
|
*/
|
|
|
|
dryRun = !((System.env.TRAVIS_TAG as boolean) && (System.env.TRAVIS_JDK_VERSION == 'oraclejdk7'))
|
2014-10-22 16:59:42 +00:00
|
|
|
|
|
|
|
pkg {
|
|
|
|
userOrg = 'jruby-gradle'
|
|
|
|
repo = 'libraries'
|
|
|
|
name = 'redstorm'
|
|
|
|
labels = ['jruby', 'redstorm', 'storm']
|
|
|
|
|
|
|
|
version {
|
|
|
|
name = project.version
|
|
|
|
vcsTag = "v${project.version}"
|
2015-08-17 18:14:09 +00:00
|
|
|
desc = project.description
|
2014-10-22 16:59:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bintrayUpload.dependsOn assemble
|
|
|
|
|
2015-09-09 20:12:53 +00:00
|
|
|
install.dependsOn check, assemble
|
|
|
|
|
|
|
|
idea {
|
|
|
|
module {
|
|
|
|
downloadJavadoc true
|
|
|
|
downloadSources true
|
|
|
|
}
|
|
|
|
}
|
2014-10-20 21:18:55 +00:00
|
|
|
// vim: ft=groovy et ts=4 sw=4
|
|
|
|
|