forked from uwescience/myria
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
289 lines (241 loc) · 8.98 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
/* This project uses Java and Eclipse. */
import org.gradle.plugins.ide.eclipse.model.SourceFolder
apply plugin: "java"
apply plugin: "eclipse"
/* Coveralls with JaCoCo */
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
/* Set up group and version info for myria */
archivesBaseName = "myria"
group = "edu.washington.escience.myria"
version = "0.1"
task wrapper(type: Wrapper) {
gradleVersion = '2.2.1'
}
/* We use Java 1.7 */
sourceCompatibility = 1.7
targetCompatibility = 1.7
/* Gradle's build script */
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.0'
}
}
/* Tell gradle where the source code is located. */
sourceSets {
/* Code for main */
main {
java.srcDir 'src'
java.srcDir 'protobuf/java'
java.srcDir 'third-party-src'
resources.srcDir 'conf'
output.classesDir = 'build/main'
}
/* Code for tests */
test {
java.srcDir 'test'
output.classesDir = 'build/test'
}
/* Code for systemtests */
systemtest {
java.srcDir 'systemtest'
output.classesDir = 'build/systemtest'
}
/* Code for speedtests */
speedtest {
java.srcDir 'speedtest'
output.classesDir = 'build/speedtest'
}
/* Code for testsuites */
testsuites {
java.srcDir 'testsuites'
output.classesDir = 'build/testsuites'
}
}
/* Compile, but don't run the speed tests when building the project. */
check.dependsOn speedtestClasses
check.dependsOn systemtestClasses
check.dependsOn testsuitesClasses
/* Build the Eclipse .classpath file first, because if Gradle's build fails
* we'll want to use Eclipse to debug it. */
test.dependsOn eclipseClasspath
tasks.eclipseClasspath.dependsOn cleanEclipseClasspath
/*
* List the compile and runtime dependencies of all the tests.
* Note that "group:name:version" dependencies will be downloaded from Maven.
*/
/* Where we will fetch external JAR files from. */
repositories {
mavenCentral() /* The standard Java Maven repository. */
maven { url "http://clojars.org/repo" } /* Clojars, for MonetDB */
flatDir {
name 'localRepository'
}
}
repositories.localRepository {
dirs './lib'
}
/* List constants that we use in multiple places. */
ext.slf4jVersion = "1.7.9"
ext.jacksonVersion = "2.4.4"
ext.jerseyVersion = "2.14"
ext.swaggerVersion = "2.11"
ext.swaggerMinorVersion = "1.3.11"
dependencies {
compile ("org.apache.hadoop:hadoop-core:1.2.1") {
/* Hadoop depends on Jersey 1 but we don't need it. Exclude it to prevent
* Classloader picking the wrong version of Jersey classes. */
exclude group: "com.sun.jersey"
}
compile "xerces:xercesImpl:2.11.0"
compile "xalan:xalan:2.7.2"
compile "com.google.code.findbugs:annotations:3.0.0"
compile "net.jcip:jcip-annotations:1.0"
compile "org.ini4j:ini4j:0.5.2"
compile "com.almworks.sqlite4java:sqlite4java:1.0.392"
compile "com.google.guava:guava:18.0"
compile "com.google.protobuf:protobuf-java:2.6.1"
compile "io.netty:netty:3.9.6.Final"
compile "com.goldmansachs:gs-collections:5.1.0"
compile "com.goldmansachs:gs-collections-api:5.1.0"
compile "joda-time:joda-time:2.6"
compile "commons-io:commons-io:2.4"
compile "org.apache.commons:commons-lang3:3.3.2"
compile "commons-cli:commons-cli:1.2"
compile "org.glassfish.jersey.core:jersey-server:${jerseyVersion}"
compile "org.glassfish.jersey.core:jersey-client:${jerseyVersion}"
compile "org.glassfish.jersey.core:jersey-common:${jerseyVersion}"
compile "org.glassfish.jersey.containers:jersey-container-grizzly2-http:${jerseyVersion}"
compile "org.glassfish.jersey.media:jersey-media-multipart:${jerseyVersion}"
compile "org.glassfish.jersey.media:jersey-media-json-jackson:${jerseyVersion}"
compile "javax.annotation:javax.annotation-api:1.2"
compile "com.fasterxml.jackson.jaxrs:jackson-jaxrs-providers:${jacksonVersion}"
compile "com.fasterxml.jackson.datatype:jackson-datatype-joda:${jacksonVersion}"
compile "com.fasterxml.jackson.datatype:jackson-datatype-guava:${jacksonVersion}"
compile "com.wordnik:swagger-jersey2-jaxrs_${swaggerVersion}:${swaggerMinorVersion}"
compile "org.slf4j:slf4j-api:${slf4jVersion}"
//runtime "org.slf4j:slf4j-simple:${slf4jVersion}"
runtime "org.slf4j:slf4j-log4j12:${slf4jVersion}"
compile "org.apache.commons:commons-csv:1.1"
// Expression compiler
compile "org.codehaus.janino:janino:2.7.7"
compile "org.postgresql:postgresql:9.3-1102-jdbc41"
testCompile "junit:junit:4.12"
testCompile "com.carrotsearch:junit-benchmarks:0.7.2"
systemtestCompile sourceSets.main.output
systemtestCompile configurations.testCompile
systemtestCompile sourceSets.test.output
systemtestRuntime configurations.testRuntime
speedtestCompile sourceSets.main.output
speedtestCompile configurations.systemtestCompile
speedtestCompile sourceSets.systemtest.output
speedtestRuntime configurations.systemtestRuntime
testsuitesCompile sourceSets.main.output
testsuitesCompile configurations.systemtestCompile
testsuitesCompile sourceSets.systemtest.output
testsuitesRuntime configurations.systemtestRuntime
}
/* Tell Java to emit all compiler warnings. */
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint"
}
/* Tell all tasks to add sqlite library to their classpath when running. */
tasks.withType(Test) {
systemProperty "java.library.path", file("lib/sqlite4java-392")
getReports().getHtml().setDestination(file('build/reports/'+name))
// set heap size for the test JVM(s)
minHeapSize = "512m"
maxHeapSize = "2048m"
}
/* Tell gradle where additional tests & testsuites should look for classes. */
task systemtest(type: Test) {
testClassesDir = sourceSets.systemtest.output.classesDir
classpath = sourceSets.systemtest.runtimeClasspath
}
task speedtest(type: Test) {
testClassesDir = sourceSets.speedtest.output.classesDir
classpath = sourceSets.speedtest.runtimeClasspath
}
task testsuites(type: Test) {
testClassesDir = sourceSets.testsuites.output.classesDir
classpath = sourceSets.testsuites.runtimeClasspath
}
/* The eclipseClasspath task will build a local Eclipse .classpath file. */
eclipse.classpath {
/* Ensure Eclipse compiled output appears in build directory. */
defaultOutputDir = file('build/main')
/* Download library sources and Javadoc for use in debugging. */
downloadSources = true
downloadJavadoc = true
file {
/* Ugly hack to stick the JNI pointer for sqlite into the .classpath file. */
withXml {
provider ->
provider.asNode().findAll { [email protected]("sqlite") }.each {
it.children().each {
it.appendNode('attribute', [name: 'org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY', value:'myria/lib/sqlite4java-392'])
}
}
}
/* Separate output folder for each src folders*/
whenMerged {
cp ->
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("src") }*.output = "build/main"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("protobuf") }*.output = "build/main"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("third-party-src") }*.output = "build/main"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("test") }*.output = "build/test"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("systemtest") }*.output = "build/systemtest"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("speedtest") }*.output = "build/speedtest"
cp.entries.findAll { it instanceof SourceFolder && it.path.startsWith("testsuites") }*.output = "build/testsuites"
}
}
}
tasks.withType(Test) {
/* Optional: uncomment the next line to print which test is running. Useful for debugging. */
beforeTest { desc -> println "Executing test ${desc.name} [${desc.className}]" }
testLogging { exceptionFormat = 'full' }
}
/*
* Copy all the jars that this project depends on into `build/libs`, and make
* sure it this happens whenever jar is run.
*/
task copyToLib(type: Copy) {
into "$buildDir/libs"
from configurations.runtime
}
tasks.jar.dependsOn copyToLib
/* Make sure test runs before any other type of tests */
systemtest.dependsOn test
speedtest.dependsOn test
/* allTests just runs all tests */
task allTests
allTests.dependsOn test
allTests.dependsOn systemtest
allTests.dependsOn speedtest
/* Make check run system tests. */
check.dependsOn systemtest
/* Assemble the Myria jar into `build/libs` */
jar {
manifest {
attributes("Implementation-Title" : "Myria",
"Implementation-Version": version,
"Main-Class": "edu.washington.escience.myria.daemon.MasterDaemon")
}
}
/* Coveralls */
jacocoTestReport {
executionData(test, systemtest)
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
/* Update the version and branch in constants.java. */
task updateCommitInfo(type:Exec) {
commandLine './update_commit_id.sh'
}
compileJava.dependsOn updateCommitInfo
eclipseClasspath.dependsOn updateCommitInfo