forked from divolte/divolte-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
267 lines (229 loc) · 8.01 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
/*
* Copyright 2014 GoDataDriven B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'application'
apply plugin: 'groovy'
defaultTasks 'clean', 'build'
group = 'io.divolte'
version = '0.2-SNAPSHOT'
sourceCompatibility = 1.8
mainClassName = 'io.divolte.server.Server'
applicationName = 'divolte-collector'
applicationDefaultJvmArgs = [
"-XX:+UseG1GC",
"-Djava.awt.headless=true"
]
// This applies to all JavaCompile tasks, not just :compileJava
// (which is the delegate for compileJava {}).
tasks.withType(JavaCompile) {
// All our files are UTF-8 encoded.
options.encoding = 'UTF-8'
// Log details about usage of deprecated symbols.
options.deprecation = true
}
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://repository-saucelabs.forge.cloudbees.com/release'
}
maven {
url 'http://repository.codehaus.org/'
}
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: '1.1.1'
}
}
dependencies {
compile group: 'io.divolte', name: 'divolte-schema', version: '0.1'
compile group: 'io.undertow', name: 'undertow-core', version: '1.0.16.Final'
compile group: 'com.typesafe', name: 'config', version: '1.2.1'
compile group: 'com.google.guava', name: 'guava', version: '17.0'
compile group: 'org.apache.avro', name: 'avro', version: '1.7.7'
/*
* We package the Avro Tools to provide an easy way to view Avro files
* Because the default artifact (without the nodeps classifier) contains
* some kind of uberjar with a old hadoop dependency, we manually include
* the deps that we require for the tools to work and depend on the nodeps
* variant of the tools itself. This is the minimal list to make the tool
* run and have a working tojson command. The other commands weren't fully
* tested with these deps.
*/
compile group: 'org.apache.avro', name: 'avro-tools', version: '1.7.7', classifier: 'nodeps'
compile group: 'org.apache.avro', name: 'trevni-core', version: '1.7.7'
compile group: 'org.apache.avro', name: 'avro-mapred', version: '1.7.7'
compile (group: 'org.apache.hadoop', name:'hadoop-common', version: '2.4.1') {
exclude group: 'jline', module: 'jline'
}
compile group: 'org.apache.hadoop', name:'hadoop-hdfs', version: '2.4.1'
compile (group: 'net.sf.uadetector', name: 'uadetector-core', version: '0.9.21') {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
compile group: 'net.sf.uadetector', name: 'uadetector-resources', version: '2014.09'
compile (group: 'com.maxmind.geoip2', name: 'geoip2', version:'0.8.1') {
// We only use DB mode, and Google's HTTP client pulls in Apache HTTP
// client which conflicts with the version via Hadoop.
exclude group: 'com.google.http-client', module: 'google-http-client'
}
compile group: 'org.apache.kafka', name:'kafka_2.10', version:'0.8.1.1'
compile group: 'com.google.javascript', name:'closure-compiler', version:'v20140814'
compile group: 'org.codehaus.groovy', name:'groovy', version: '2.3.8', classifier: 'indy'
// We use the SLF4J API. At runtime, this is LogBack.
// (We also force any dependencies that use Log4J to go via SLF4J.)
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.7'
runtime group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.2'
runtime group: 'org.slf4j', name: 'log4j-over-slf4j', version: '1.7.7'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
testCompile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
testCompile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.3.20'
testCompile group: 'com.fasterxml.jackson.core', name:'jackson-databind', version: '2.4.2'
testCompile group: 'com.saucelabs', name:'sauce_junit', version: '2.1.3'
testCompile group: 'org.seleniumhq.selenium', name:'selenium-java', version: '2.42.2'
testCompile group: 'com.github.detro.ghostdriver', name: 'phantomjsdriver', version: '1.0.4'
}
configurations {
// Exclude all traces of Log4J via transitive dependencies.
// (At runtime these are redirected over SLF4J.)
all*.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
all*.exclude group: 'log4j', module: 'log4j'
}
shadowJar {
mergeServiceFiles()
}
tasks.withType(FindBugs) {
classes = classes.filter {
!it.path.contains("io/divolte/groovyscript/")
}
dependsOn = [compileJava, compileTestJava]
}
findbugs() {
toolVersion = "3.0.0"
}
pmd {
toolVersion = "5.1.3"
}
jacoco {
toolVersion = "0.7.1.201405082137"
}
findbugsMain.reports {
xml.enabled = true
html.enabled = false
}
findbugsTest.reports {
xml.enabled = true
html.enabled = false
}
task wrapper(type: Wrapper) {
gradleVersion = '2.1'
}
/*
* This only applies to running with gradle run. We use a different run
* script when creating a distribution.
*/
run {
if (System.getenv().containsKey("HADOOP_CONF_DIR")) {
classpath += files(System.getenv("HADOOP_CONF_DIR"))
}
if (System.getenv().containsKey("YARN_CONF_DIR")) {
classpath += files(System.getenv("YARN_CONF_DIR"))
}
}
/*
* Build distribution .tar.gz or .zip. We don't use the distribution
* plugin as that allows for less flexibility in laying out the
* archive. It also conflicts in non-trivial ways with the application
* plugin (or the other way around).
*/
def distributionLayout = {
def baseDir = archiveName - (".${extension}")
into("${baseDir}/lib/") {
from project.configurations.runtime
}
into("${baseDir}/lib/") {
from(project.buildDir.path + "/libs") {
include "**/*.jar"
}
}
into("${baseDir}/conf/") {
from("src/dist/conf") {
include "**/*"
}
// Use the reference.conf as a example application.conf
from("src/main/resources/reference.conf") {
rename("reference.conf", "divolte-collector.conf.example")
}
}
into("${baseDir}/bin/") {
from("src/scripts") {
include "**/*"
}
}
}
task tarball(dependsOn: build, type: Tar) {
compression = Compression.GZIP
extension = "tar.gz"
configure distributionLayout
}
task zip(dependsOn: build, type: Zip) {
configure distributionLayout
}
/*
* Generate Sphinx documentation
*/
task processUserDoc {
ext.source = file("docs")
ext.sphinxDir = new File(buildDir, "sphinx")
inputs.dir source
outputs.dir sphinxDir
}
import org.apache.tools.ant.filters.ReplaceTokens
processUserDoc << {
// Copy/replace @version@
copy {
from(source) {
filter(ReplaceTokens, tokens: ["version": version])
}
into sphinxDir
exclude "**/*.png"
}
// Copy images (no replacement)
copy {
from(source)
into sphinxDir
include "**/*.png"
}
}
task userDoc(dependsOn: processUserDoc, type: Exec) {
ext.sphinxDir = processUserDoc.sphinxDir
ext.htmlDocDir = new File(buildDir, "userdoc/html")
inputs.dir sphinxDir
outputs.dir htmlDocDir
workingDir sphinxDir
executable "sphinx-build"
args '-b', 'html', sphinxDir, htmlDocDir
}