-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.gradle
185 lines (159 loc) · 5.92 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
buildscript {
repositories {
mavenCentral()
}
apply from: file("gradle/buildscript.gradle"), to: buildscript
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://repository.apache.org/content/repositories/snapshots/"
}
maven {
url "http://conjars.org/repo"
}
}
}
apply from: file("gradle/dependency-versions.gradle")
apply from: file("gradle/dependency-versions-scala-" + scalaVersion + ".gradle")
allprojects {
apply plugin: "idea"
}
project(":samza-sql-core_$scalaVersion") {
apply plugin: "java"
dependencies {
compile "org.apache.samza:samza-api:$samzaVersion"
compile "org.apache.samza:samza-core_$scalaVersion:$samzaVersion"
compile "org.apache.samza:samza-kv_$scalaVersion:$samzaVersion"
compile "commons-collections:commons-collections:$commonsCollectionVersion"
compile("io.confluent:kafka-schema-registry:$schemaRegistryVersion") {
exclude group: "com.fasterxml.jackson.core"
}
compile "org.apache.avro:avro:$avroVersion"
compile "org.apache.curator:curator-framework:$curatorVersion"
testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
}
}
project(":samza-sql-planner_$scalaVersion") {
apply plugin: "java"
apply plugin: "scala"
sourceSets.main.scala.srcDir "src/main/java"
sourceSets.main.java.srcDirs = []
dependencies {
compile project(":samza-sql-core_$scalaVersion")
compile "org.apache.samza:samza-kafka_$scalaVersion:$samzaVersion"
compile("org.apache.calcite:calcite-core:$calciteVersion") {
exclude group: 'com.fasterxml.jackson.core'
}
compile "com.101tec:zkclient:$zkClientVersion"
compile "org.apache.zookeeper:zookeeper:$zookeeperVersion"
compile "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
compile "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion"
compile "org.apache.kafka:kafka-clients:$kafkaVersion"
compile "com.google.code.gson:gson:$gsonVersion"
compile "org.apache.curator:curator-framework:$curatorVersion"
testCompile "org.apache.curator:curator-test:$curatorVersion"
testCompile "io.confluent:kafka-schema-registry:$schemaRegistryVersion"
testCompile "org.apache.kafka:kafka_$scalaVersion:$kafkaVersion:test"
testCompile "junit:junit:$junitVersion"
testCompile "org.mockito:mockito-all:$mockitoVersion"
}
}
project(":samza-sql-jdbc") {
apply plugin: "java"
dependencies {
compile project(":samza-sql-core_$scalaVersion")
compile project(":samza-sql-planner_$scalaVersion")
testCompile "junit:junit:$junitVersion"
}
}
project(":samza-sql-shell") {
apply plugin: "java"
defaultTasks 'distTar'
// a configuration for dependencies that need exploding into package
configurations {
explode
}
dependencies {
compile project(":samza-sql-jdbc")
compile "sqlline:sqlline:$sqllineVersion"
compile "org.slf4j:slf4j-api:$slf4jVersion"
compile "org.slf4j:slf4j-log4j12:$slf4jVersion"
explode(group: 'org.apache.samza', name: 'samza-shell', ext: 'tgz', classifier: 'dist', version: "$samzaVersion")
testCompile "junit:junit:$junitVersion"
runtime(group: 'org.apache.samza', name: 'samza-log4j', version: "$samzaVersion")
runtime(group: 'org.apache.samza', name: 'samza-shell', version: "$samzaVersion")
runtime(group: 'org.apache.samza', name: 'samza-yarn_2.10', version: "$samzaVersion")
runtime(group: 'org.apache.samza', name: 'samza-kv-rocksdb_2.10', version: "$samzaVersion")
runtime(group: 'org.apache.samza', name: 'samza-kafka_2.10', version: "$samzaVersion")
runtime(group: 'org.apache.kafka', name: 'kafka_2.10', version: "$kafkaVersion")
runtime(group: 'org.apache.hadoop', name: 'hadoop-hdfs', version: "$hadoopVersion")
}
// make the samza distribution .tgz file
task distTar(dependsOn: build, type: Tar) {
destinationDir(new File(project.buildDir, "/distributions"))
compression(Compression.GZIP)
classifier('dist')
extension('tar.gz')
into("config") {
from("src/main/config") {
include "orders-feed.properties"
// expand the Maven tokens with Gradle equivalents. Also change 'target' (Maven) to 'build/distributions' (Gradle)
filter { String line ->
line.replaceAll('[\$][{]basedir[}]', project.projectDir.toString()).replaceAll('[\$][{]project.artifactId[}]', project.name.toString()).replaceAll('/target/', '/build/distributions/').replaceAll('[\$][{]pom.version[}]', version)
}
}
}
into("bin") {
from {
configurations.explode.collect { tarTree(it) }
}
}
into("bin") {
from("src/main/bash") {
include "samzasql"
}
}
into("lib") {
from configurations.runtime
from configurations.runtime.artifacts.files
from("src/main/resources/") {
include "log4j.properties"
}
}
}
task installGrid(type: Exec) {
workingDir(project.projectDir)
commandLine("bin/grid", "install", "all")
outputs.upToDateWhen {
["kafka", "zookeeper", "yarn"].every {
(new File(project.projectDir, "deploy/" + it)).exists()
}
}
}
task deploySamzaSQL(dependsOn: [distTar, installGrid], type: Sync) {
into(new File(project.projectDir, "/deploy/samzasql"))
from(tarTree(distTar.archivePath))
}
task startGrid(dependsOn: [installGrid], type: Exec) {
workingDir(project.projectDir)
commandLine("bin/grid", "start", "all")
outputs.upToDateWhen {
// use running zookeeper as proxy
File zookeeperPidFile = new File("/tmp/zookeeper/zookeeper_server.pid")
zookeeperPidFile.exists() &&
"kill -0 ${zookeeperPidFile.text}".execute().waitFor() == 0
}
}
task stopGrid(type: Exec) {
workingDir(project.projectDir)
commandLine("bin/grid", "stop", "all")
}
task sqlShell(dependsOn: [deploySamzaSQL], type: Exec) {
workingDir(project.projectDir)
commandLine("deploy/samzasql/bin/samzasql")
}
}