forked from colinsurprenant/redstorm
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
190 lines (155 loc) · 5.14 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
//
// Primary gradle file for building and testing redstorm
//
buildscript {
repositories {
jcenter()
}
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"
}
}
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'com.github.jruby-gradle.jar'
apply plugin: 'com.jfrog.bintray'
version = '0.9.2'
group = 'com.github.jruby-gradle'
description = "RedStorm integrates Ruby code via JRuby into the Storm distributed computation system"
defaultTasks 'check', 'assemble'
// Any time we're not expicitly saying "build me a release build" we'll change
// the version to -SNAPSHOT
if (!(System.env.TRAVIS_TAG as Boolean)) {
version = "${version}-SNAPSHOT"
}
import com.github.jrubygradle.JRubyExec
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
}
dependencies {
// These compile dependencies are required just to compile our Java-based
// redstorm code
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)"
// Gem dependencies needed to run our Ruby development tasks like 'spec'
jrubyExec 'rubygems:rspec:2.99.0+'
jrubyExec 'rubygems:coveralls:0.6.7+'
}
////////////////////////////////////////////////////////////////////////////////
// DEVELOPMENT TASKS
////////////////////////////////////////////////////////////////////////////////
task compileRedstormJRuby(type: JRubyExec) {
def generatedDir = file("${buildDir}/generated/java")
group 'build'
description "Compile the right Ruby files to Java files for compilation"
inputs.dir('lib/red_storm')
outputs.dir(generatedDir)
workingDir 'lib/red_storm'
script 'jrubyc'
scriptArgs '--prefix', 'red_storm',
'--java',
'--target', generatedDir.absolutePath,
'topology_launcher.rb'
doFirst {
generatedDir.mkdirs()
}
}
// 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
project.compileJava.dependsOn compileRedstormJRuby
task spec(type: JRubyExec) {
group 'JRuby'
description 'Run the RSpec examples'
script 'rspec'
dependsOn compileJava
}
check.dependsOn spec
////////////////////////////////////////////////////////////////////////////////
sourceSets {
main {
java {
srcDirs "src/main",
"${buildDir}/generated/java"
}
}
}
/* 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
}
}
// In addition to all of the compiled java sources, we need to include the Ruby
// code from ./lib in the .jar archive
jar {
from 'lib'
}
// Make sure we're created a sources jar to be published to jcenter
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']
/*
* 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 == 'openjdk7'))
pkg {
userOrg = 'jruby-gradle'
repo = 'libraries'
name = 'redstorm'
labels = ['jruby', 'redstorm', 'storm']
version {
name = project.version
vcsTag = "v${project.version}"
desc = project.description
}
}
}
bintrayUpload.dependsOn assemble
install.dependsOn check, assemble
idea {
module {
downloadJavadoc true
downloadSources true
}
}
// vim: ft=groovy et ts=4 sw=4