forked from pinterest/secor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
298 lines (257 loc) · 9.59 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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
ext.githubProjectName = "1p-secor-service"
apply plugin: 'java'
apply plugin: 'maven'
// 1p-service stuff - BEGIN
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'distribution'
apply plugin: 'java-library-distribution'
apply plugin: 'os-package'
apply plugin: 'net.researchgate.release'
apply plugin: 'sonar-runner'
apply plugin: 'jacoco'
// END
// group = 'com.pinterest'
// version = '0.7-SNAPSHOT'
description = """1p-secor-service"""
sourceCompatibility = 1.8
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8' // 1p-service stuff
targetCompatibility = 1.8
// 1p-service stuff - BEGIN
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}
apply from: file('codequality/check.gradle')
def permanentPackageName = project.name
def group = 'thomsonreuters-1p'
def rpmRelease = 1
def snapshot = true
if (snapshot) { rpmRelease = 'SNAPSHOT' }
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 1, 'hours'
resolutionStrategy.cacheChangingModulesFor 1, 'hours'
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
resources {
srcDir 'src/main/resources'
srcDir 'src/main/config'
}
}
test {
java {
srcDir 'src/test/java'
}
resources {
srcDir 'src/test/resources'
}
}
}
test {
//enable to see logging during gradle build
//testLogging.showStandardStreams = true
testLogging {
events "passed", "skipped", "failed"
}
}
eclipse {
classpath {
downloadSources = true
}
}
idea {
module {
jdkName = '1.8'
downloadSources = true
}
}
// END
// Since we need to pull third party jars, we need to wrap around the "classpath" method with "buildscript".
// I suspect we do not have to do it this way but this file is merged from build.gradle from three different
// places,1p-service, 1p-project-templates, and 1p-secor-service
buildscript {
repositories {
// 1p-service stuff - BEGIN
mavenCentral()
jcenter()
maven {
url = "https://clojars.org/repo/"
}
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
maven {
url 'http://kundera.googlecode.com/svn/maven2/maven-missing-resources'
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/thirdparty/"
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/snapshots/"
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/releases/"
}
// END
maven { url "http://maven.twttr.com" }
maven { url "http://repo.typesafe.com/typesafe/releases" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
// 1p-service stuff - BEGIN
classpath group: 'com.netflix.nebula', name: 'gradle-ospackage-plugin', version: '2.2.0'
classpath group: 'org.jsonschema2pojo', name: 'jsonschema2pojo-gradle-plugin', version: '0.4.+'
classpath group: 'com.thomsonreuters', name: '1p-service-api', version: "${servicelib_version}"
classpath group: 'com.thomsonreuters.data', name: '1p-data-event', version: '1.0'
classpath group: 'com.thomsonreuters.data', name: '1p-data-util', version: '1.0'
classpath group: 'net.researchgate', name: 'gradle-release', version: '2.1.1'
classpath group: 'com.bmuschko', name: 'gradle-nexus-plugin', version: '2.3'
classpath group: 'eu.appsatori', name: 'gradle-fatjar-plugin', version: '0.3'
classpath group: 'com.thomsonreuters', name: 'storm-deploy', version: '2.4.+'
// END
}
}
repositories {
// 1p-service stuff - BEGIN
mavenCentral()
jcenter()
maven {
url = "https://clojars.org/repo/"
}
maven {
url 'https://oss.sonatype.org/content/groups/public'
}
maven {
url 'http://kundera.googlecode.com/svn/maven2/maven-missing-resources'
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/thirdparty/"
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/snapshots/"
}
maven {
url "http://repo.1p.thomsonreuters.com/nexus/content/repositories/releases/"
}
// END
maven { url "http://maven.twttr.com" }
maven { url "http://repo.typesafe.com/typesafe/releases" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
// 1p-service stuff - BEGIN
compile group: 'com.thomsonreuters', name: '1p-service-lib', version: "${servicelib_version}"
compile group: 'com.thomsonreuters', name: '1p-service-swagger', version: "${servicelib_version}"
compile group: 'com.thomsonreuters', name: '1p-service-api', version: "${servicelib_version}"
compile group: 'com.thomsonreuters.data', name: '1p-data-event', version: '1.0'
compile group: 'com.thomsonreuters.data', name: '1p-data-util', version: '1.0'
compile group: 'com.thomsonreuters', name: 'eiddo-client', version: '0.4.+'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.5.+'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.5.+'
testCompile group: 'junit', name: 'junit-dep', version: '4.11'
// Jersey test framework
testCompile 'com.sun.jersey.jersey-test-framework:jersey-test-framework-core:1.11'
testCompile 'com.sun.jersey.jersey-test-framework:jersey-test-framework-external:1.11'
// END
compile group: 'com.google.protobuf', name: 'protobuf-java', version:'2.6.1'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version:'1.10.2'
compile group: 'net.java.dev.jets3t', name: 'jets3t', version:'0.9.4'
compile(group: 'org.apache.kafka', name: 'kafka_2.10', version:'0.8.2.1') {
exclude(module: 'slf4j-simple')
}
compile(group: 'log4j', name: 'log4j', version:'1.2.15') {
exclude(module: 'jmxri')
exclude(module: 'jmxtools')
exclude(module: 'jms')
}
compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.2'
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version:'1.7.2'
compile group: 'org.slf4j', name: 'slf4j-log4j12', version:'1.7.2'
compile group: 'commons-configuration', name: 'commons-configuration', version:'1.9'
compile group: 'org.apache.hadoop', name: 'hadoop-common', version:'2.7.0'
compile(group: 'org.apache.hadoop', name: 'hadoop-aws', version:'2.7.0') {
exclude(module: 'jets3t')
exclude(module: 'jackson-annotations')
exclude(module: 'jackson-core')
exclude(module: 'jackson-databind')
}
compile group: 'org.apache.hadoop', name: 'hadoop-openstack', version:'2.7.0'
compile group: 'org.apache.thrift', name: 'libthrift', version:'0.9.3'
compile group: 'com.twitter', name: 'ostrich_2.10', version:'9.2.1'
compile group: 'com.twitter.common.zookeeper', name: 'lock', version:'0.0.7'
compile group: 'com.google.guava', name: 'guava', version:'18.0'
compile group: 'net.minidev', name: 'json-smart', version:'2.0-RC3'
compile group: 'org.mockito', name: 'mockito-all', version:'1.9.5'
compile group: 'org.msgpack', name: 'jackson-dataformat-msgpack', version:'0.7.0-p2'
compile group: 'com.timgroup', name: 'java-statsd-client', version:'3.0.2'
compile(group: 'com.google.apis', name: 'google-api-services-storage', version:'v1-rev40-1.20.0') {
exclude(module: 'guava-jdk5')
}
testCompile group: 'junit', name: 'junit', version:'4.11'
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version:'1.5.2'
testCompile group: 'org.powermock', name: 'powermock-api-mockito', version:'1.5.2'
}
//packaging tests
task packageTests(type: Jar) {
from sourceSets.test.output
classifier = 'tests'
}
artifacts.archives packageTests
// 1p-service stuff - BEGIN
//eiddo repo is the same as project name by default but you can change it
def eiddoRepo = rootProject.name
ospackage {
packageName = permanentPackageName
release = rpmRelease
arch = NOARCH
os = LINUX
from(file('root/etc/reuters/karyon')) {
into('/etc/reuters')
user 'root'
permissionGroup 'root'
}
from("build/install/"+ permanentPackageName) {
into('/opt/reuters/apps/karyon')
user 'karyon'
permissionGroup 'karyon'
}
}
buildRpm.dependsOn installDist
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://sonar.oneplatform.build"
property "sonar.jdbc.url", "jdbc:mysql://sonar.c35w2xq4gxyh.us-west-2.rds.amazonaws.com:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
property "sonar.jdbc.username", "$System.env.sonarUsername"
property "sonar.jdbc.password", "$System.env.sonarPassword"
}
}
jacoco {
toolVersion = "0.7.4.+"
reportsDir = file("$buildDir/reports/coverage")
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled false
html.destination "${buildDir}/reports/coverage/html"
}
}
//END
// Generate the "build.properties" file used by the OstrichService in Secor
task createOstrichProps << {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'git'
args = ['log', '--pretty=format:%H', '-n1']
standardOutput = os
}
def outputAsString = 'build_revision='+os.toString()
def buildProps = new File('build/classes/main/com/pinterest/secor/common/build.properties')
buildProps.write(outputAsString+'\n')
}
}
processResources.dependsOn createOstrichProps