-
Notifications
You must be signed in to change notification settings - Fork 38
/
build.gradle
231 lines (197 loc) · 6.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
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
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.2.4'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.0.3'
// https://github.com/kt3k/coveralls-gradle-plugin
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
classpath 'com.netflix.nebula:gradle-ospackage-plugin:2.2.0'
classpath 'com.commercehub.gradle.plugin:gradle-avro-plugin:0.3.4'
}
}
group = 'com.verisign.storm.metrics'
version = '1.0.0-SNAPSHOT'
description = "An IMetricsConsumer that forwards Storm's built-in metrics to a Graphite server for real-time graphing."
apply plugin: 'java'
apply plugin: 'cobertura'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'os-package'
apply plugin: 'com.commercehub.gradle.plugin.avro'
// Helper functions for RPM metadata
def shortCommit = "git rev-parse --short HEAD".execute().in.text.trim()
def buildTime() {
def df = new java.text.SimpleDateFormat('yyyyMMdd')
df.setTimeZone(TimeZone.getTimeZone('UTC'))
return df.format(new Date())
}
ext {
jdkVersion = '1.7'
metricsVersion = '3.1.0'
// RPM metadata
rpmMaintainer = System.getenv('MAINTAINER') ?: '[email protected]'
rpmVersion = System.getenv('VERSION') ?: "${project.version}"
isSnapshot = rpmVersion.endsWith('-SNAPSHOT') ? true : false
if (isSnapshot) {
rpmVersion = rpmVersion.replace('-SNAPSHOT', '')
}
rpmRelease = '1'
overriddenRpmRelease = System.getenv('RPM_RELEASE')
if (overriddenRpmRelease != null) {
rpmRelease = overriddenRpmRelease
}
else if (isSnapshot) {
defaultBuildNumber = '1'
releaseNumberIncrement = System.getenv('BUILD_NUMBER') ?: "${defaultBuildNumber}"
snapshotReleaseTag = "0.${releaseNumberIncrement}.${buildTime()}git${shortCommit}"
rpmVersion = rpmVersion.replace('-SNAPSHOT', '')
rpmRelease = snapshotReleaseTag
}
}
sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion
repositories {
mavenCentral()
maven { url 'https://clojars.org/repo' }
maven { url 'http://packages.confluent.io/maven/' }
}
dependencies {
compile(
['com.google.guava:guava:17.0'],
["io.dropwizard.metrics:metrics-core:${metricsVersion}"],
["io.dropwizard.metrics:metrics-graphite:${metricsVersion}"],
["org.coursera:metrics-datadog:1.1.3"],
["com.twitter:bijection-core_2.10:0.7.0"],
["com.twitter:bijection-avro_2.10:0.7.0"],
["com.twitter:util-core_2.10:6.1.0"],
["org.apache.kafka:kafka_2.10:0.8.2.0-cp"],
["io.confluent:kafka-avro-serializer:1.0"],
["io.confluent:kafka-schema-registry-client:1.0"],
["org.apache.avro:avro:1.7.6"]
)
compile(
['org.apache.storm:storm-core:1.0.1'],
) {
// The log4j-over-slf4j dependency conflicts with slf4j-log4j12
exclude module: 'log4j-over-slf4j'
}
testCompile(
['org.apache.curator:curator-test:2.6.0'],
['org.apache.curator:curator-framework:2.6.0'],
['org.uncommons:reportng:1.1.4'],
['org.mockito:mockito-all:1.9.5'],
['org.easytesting:fest-assert-core:2.0M10'],
['org.testng:testng:6.8.8'],
// Manually require Google Guice. This is a required workaround for a known issue with TestNG 6.x.
// (Gradle will fail to run tests otherwise.)
['com.google.inject:guice:3.0'],
['org.apache.commons:commons-lang3:3.4']
)
}
task sourcesJar(type: Jar, dependsOn: 'classes') {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: 'javadoc') {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
archives shadowJar
}
test {
useTestNG() {
suiteXmlBuilder().suite(name: 'storm-graphite', parallel: 'tests', 'thread-count': '1') {
test (name : 'all-tests') {
packages {
'package' (name: 'com.verisign.*')
}
}
}
}
options {
listeners << 'org.uncommons.reportng.HTMLReporter'
listeners << 'org.uncommons.reportng.JUnitXMLReporter'
}
ext.useDefaultListeners = true
ext.workingDirectory = 'build/'
}
// https://github.com/stevesaliman/gradle-cobertura-plugin
// http://ingorichter.blogspot.ch/2013/03/using-cobertura-with-gradle.html for list of options
cobertura {
coverageFormats = ['xml', 'html'] // coveralls plugin depends on xml format report
}
task createWrapper(type: Wrapper) {
gradleVersion = '2.3'
}
ospackage {
packageName project.name
version rpmVersion
release rpmRelease
summary description
packageDescription description
packageGroup 'Development/Tools'
packager rpmMaintainer
url 'https://github.com/verisign/storm-graphite'
type BINARY
arch NOARCH
os LINUX
user 'root'
vendor 'Verisign'
license 'Apache License, Version 2.0'
}
buildRpm {
packageName = "${project.name}_slim"
into '/opt/storm'
from(jar.outputs.files) {
into 'lib'
}
}
buildRpm.dependsOn(jar)
// Creates an RPM that packages an uber jar.
task rpm(type: Rpm) {
packageName = "${project.name}"
into '/opt/storm'
from(shadowJar.outputs.files) {
into 'lib'
}
}
rpm.dependsOn(shadowJar)
buildDeb {
packageName = "${project.name}_slim"
into '/opt/storm'
from(jar.outputs.files) {
into 'lib'
}
}
buildDeb.dependsOn(jar)
// Creates a DEB that packages an uber jar.
task deb(type: Deb) {
packageName = "${project.name}"
into '/opt/storm'
from(shadowJar.outputs.files) {
into 'lib'
}
}
deb.dependsOn(shadowJar)
shadowJar {
// Relocate Metrics and Schema Registry libraries to prevent conflicts with user code that depends on Metrics, too.
relocate('com.codahale.metrics', 'com.verisign.storm-graphite.com.codahale.metrics')
relocate('io.confluent.kafka', 'com.verisign.storm-graphite.io.confluent.kafka')
dependencies {
include(dependency("io.dropwizard.metrics:metrics-core:${metricsVersion}"))
include(dependency("io.dropwizard.metrics:metrics-graphite:${metricsVersion}"))
include(dependency("io.confluent:kafka-avro-serializer:1.0"))
include(dependency("io.confluent:kafka-schema-registry-client:1.0"))
}
}
// `build` should also create the uber/shadow jar by default.
build.dependsOn(shadowJar)