-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
86 lines (68 loc) · 2.38 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
description = 'spark-word-count'
apply plugin: 'scala'
version = '0.1'
repositories {
mavenLocal()
mavenCentral()
maven {
url "https://repository.cloudera.com/artifactory/cloudera-repos"
}
}
sourceSets {
main {
resources {
exclude 'log4j.properties'
}
}
}
dependencies {
compile group: 'org.apache.spark', name: 'spark-core_2.10', version: '1.0.2'
compile group: 'org.apache.spark', name: 'spark-graphx_2.10', version: '1.0.2'
compile(
[group: 'org.slf4j', name: 'slf4j-api', version: '1.6.6'],
[group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.6.6']
)
testCompile 'junit:junit:4.11'
}
def appendDoc(String path, String doc, StringBuilder builder) {
builder.append(path)
builder.append("#")
builder.append(doc)
}
task myScalaDocs(type: ScalaDoc) {
source sourceSets.main.allSource
classpath = sourceSets.main.compileClasspath
destinationDir = file("build/docs")
List<String> parameters = new LinkedList<String>()
File sparkJar = configurations.compile.files.find { file -> file.name.contains("spark") }
File scalaJar = configurations.compile.files.find { file -> file.name.contains("scala-library") }
File graphx = configurations.compile.files.find { file -> file.name.contains("spark-graphx") }
StringBuilder builder = new StringBuilder()
builder.append("-doc-external-doc:")
appendDoc(sparkJar.absolutePath, "http://spark.apache.org/docs/latest/api/scala/index.html", builder)
builder.append(",")
appendDoc(graphx.absolutePath, "http://spark.apache.org/docs/latest/api/scala/index.html", builder)
builder.append(",")
appendDoc(scalaJar.absolutePath, "http://www.scala-lang.org/api/2.10.4/index.html", builder)
String fullParam = builder.toString()
parameters.add(fullParam)
scalaDocOptions.additionalParameters = parameters
}
task distJars(dependsOn: 'distConf', type: Copy) {
from configurations.runtime
from jar
include "spark-word-count*.jar"
include "config*.jar"
into "${buildDir}/dist/lib"
}
task distConf(dependsOn: 'assemble', type: Copy) {
from "src/main/resources"
include "log4j.properties"
include "application.conf"
into "${buildDir}/dist/conf"
}
task dist(dependsOn: 'distJars', type: Copy) {
from "src/main/resources"
include "yarn-runner"
into "${buildDir}/dist"
}