This repository has been archived by the owner on Sep 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
executable file
·245 lines (183 loc) · 6.41 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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '2.0.1'
id "com.github.maiflai.scalatest" version "0.16"
id 'com.bmuschko.docker-remote-api' version '3.1.0'
id "com.avast.gradle.docker-compose" version "0.6.6"
id "org.ajoberstar.grgit" version "2.1.0"
}
group group
version version
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.bmuschko.docker-remote-api'
apply plugin: "com.avast.gradle.docker-compose"
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
provided
compile.extendsFrom provided
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
shadow group: 'org.scala-lang', name: 'scala-library', version: scalaMinorVersion
shadow group: 'org.scala-lang', name: 'scala-reflect', version: scalaMinorVersion
shadow group: 'org.scala-lang', name: 'scala-compiler', version: scalaMinorVersion
shadow 'org.apache.spark:spark-sql_'+scalaVersion+':' + sparkVersion
shadow 'org.apache.spark:spark-streaming_'+scalaVersion+':' + sparkVersion
shadow 'org.apache.spark:spark-core_'+scalaVersion+':' + sparkVersion
compile 'org.apache.spark:spark-sql-kafka-0-10_'+scalaVersion+':' + sparkVersion
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
compile group: 'org.apache.hadoop', name: 'hadoop-aws', version: hadoopVersion
compile group: 'org.joda', name: 'joda-convert', version: '1.8.3'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'com.typesafe', name: 'config', version: '1.3.1'
compile group: 'com.typesafe.scala-logging', name: 'scala-logging_2.11', version: scalaLoggingVersion
compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.2.4'
// required for the Metrics System
compile group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.3.20.v20170531'
testCompile 'org.apache.spark:spark-sql_'+scalaVersion+':' + sparkVersion
testCompile 'org.apache.spark:spark-streaming_'+scalaVersion+':' + sparkVersion
testCompile 'org.apache.spark:spark-core_'+scalaVersion+':' + sparkVersion
testCompile 'org.scalatest:scalatest_2.11:3.0.1'
testRuntime 'org.pegdown:pegdown:1.4.2'
}
idea {
module {
// IntelliJ does not know about the standard idiom of provided as used in managing
// uber/shaded jar dependencies. Make it so!
scopes.PROVIDED.plus += [ configurations.provided ]
}
}
test {
maxParallelForks = 1
// environment variables for running integration tests
environment "AWS_ACCESS_KEY_ID", "cluesoKey1"
environment "AWS_SECRET_ACCESS_KEY", "cluesoSecretKey1"
}
dockerCompose.isRequiredBy(test)
dockerCompose {
useComposeFiles = ['docker/docker-compose.yml']
}
apply plugin: com.bmuschko.gradle.docker.DockerRemoteApiPlugin
import com.bmuschko.gradle.docker.tasks.image.*
import java.text.SimpleDateFormat
def distDir = "${rootDir}/docker/images/docker-spark/base/clueso"
clean.doFirst {
delete distDir
}
shadowJar {
mergeServiceFiles()
archiveName = "${baseName}.jar"
configurations = [project.configurations.compile]
zip64 true
dependencies {
// excluding scala and spark (except for spark kafka) because Livy already includes the rest in the classpath
// and having them in the fatJar causes conflicts
exclude(dependency {
it.moduleGroup == 'org.scala-lang'
})
exclude(dependency {
it.moduleGroup == 'org.apache.spark' && !it.moduleName.startsWith('spark-sql-kafka-')
})
exclude('application.conf')
}
}
task toolShadowJar(type: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
mergeServiceFiles()
archiveName = "${baseName}-tool.jar"
zip64 true
from sourceSets.main.output
configurations = [project.configurations.runtime, project.configurations.shadow]
exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA')
exclude('application.conf')
}
import java.text.SimpleDateFormat
import org.ajoberstar.grgit.Grgit
task releaseFile() {
doLast {
def file = new File("$distDir/RELEASE")
file.createNewFile()
file.text = """
Version: $version
Revision: ${Grgit.open(dir: '.').head().id}
Buildtime: ${new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date())}
Application-name: clueso
"""
}
}
task buildTool() {
dependsOn toolShadowJar
doLast {
copy {
from toolShadowJar.outputs
into "${distDir}/lib/"
}
copy {
from "${rootDir}/bin/"
into "${distDir}/bin/"
}
}
}
// compiles distribution
task buildDist() {
dependsOn releaseFile
dependsOn buildTool
dependsOn shadowJar
doLast {
copy {
from shadowJar.outputs
into "${distDir}/lib/"
}
}
}
task buildGraphiteImage(type: DockerBuildImage) {
inputDir = file('docker/images/grafana_graphite')
tag = 'scality/grafana_graphite:latest'
}
task buildSparkBaseImage(type: DockerBuildImage) {
dependsOn buildDist
inputDir = file('docker/images/docker-spark/base')
tag = 'scality/clueso-spark-base:latest'
}
task buildSparkMasterImage(type: DockerBuildImage) {
dependsOn buildSparkBaseImage
inputDir = file('docker/images/docker-spark/master')
tag = 'scality/clueso-spark-master:latest'
}
task buildSparkWorkerImage(type: DockerBuildImage) {
dependsOn buildSparkBaseImage
inputDir = file('docker/images/docker-spark/worker')
tag = 'scality/clueso-spark-worker:latest'
}
task buildLivyImage(type: DockerBuildImage) {
dependsOn buildSparkBaseImage
inputDir = file('docker/images/clueso-docker-livy')
tag = 'scality/clueso-livy:latest'
}
task buildDocker() {
dependsOn buildSparkMasterImage
dependsOn buildSparkWorkerImage
dependsOn buildGraphiteImage
dependsOn buildLivyImage
}
dockerCompose.doFirst {
buildSparkBaseImage
buildGraphiteImage
}