-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
66 lines (55 loc) · 1.44 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
plugins {
id 'scala'
id 'com.github.johnrengelman.shadow' version '1.2.1'
}
repositories {
jcenter()
ivy {
url "http://mirror.nexcess.net"
layout "pattern", {
artifact "[organisation]/[module]-[revision]/[module]-[revision]-[classifier].[ext]"
m2compatible = true
}
}
}
configurations {
provided
spark
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
scalaCompileOptions.useCompileDaemon = true
}
sourceSets {
main.compileClasspath += configurations.provided
test.compileClasspath += configurations.provided
test.runtimeClasspath += configurations.provided
}
dependencies {
provided 'org.apache.spark:spark-core_2.10:1.4.0'
provided 'org.scala-lang:jline:2.10.5'
spark(group: 'apache.spark', name: 'spark', version: '1.4.0') {
artifact {
name = 'spark'
type = 'tgz'
classifier = 'bin-hadoop2.4'
extension = 'tgz'
}
}
testCompile 'junit:junit:4.12'
testCompile 'org.scalatest:scalatest_2.10:2.2.5'
}
def sparkBaseDir = new File(buildDir, 'spark')
RelativePath stripParent(RelativePath p) {
return new RelativePath(p.endsWithFile, p.segments[1..-1] as String[])
}
task setupSpark(type: Copy) {
from tarTree(configurations.spark.singleFile)
into sparkBaseDir
eachFile { it.relativePath = stripParent(it.relativePath) }
includeEmptyDirs false
}
tasks.withType(Test) {
dependsOn setupSpark
environment.SPARK_HOME = sparkBaseDir.absolutePath
}