-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
447 lines (447 loc) · 13.8 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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "http://dl.bintray.com/vermeulen-mp/gradle-plugins"
}
}
}
plugins {
id "java"
id "scala"
id "signing"
id "maven-publish"
id "net.ltgt.apt" version "0.21"
id "com.bmuschko.docker-remote-api" version "4.0.5"
id "com.diffplug.gradle.spotless" version "3.18.0"
id "io.codearte.nexus-staging" version "0.20.0"
id "de.marcphilipp.nexus-publish" version "0.2.0"
id "org.ajoberstar.grgit" version "3.1.1"
id "com.wiredforcode.spawn" version "0.8.0"
}
repositories {
mavenCentral()
if (findProperty("repositoryUrl")) {
maven {
url findProperty("repositoryUrl")
}
} else {
jcenter()
maven {
url "https://repository.apache.org/snapshots"
}
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven {
url "https://oss.jfrog.org/jfrog-dependencies"
}
}
}
description = "Mongoose is a high-load storage performance testing tool"
group = "com.github.emc-mongoose"
version = "4.2.31"
sourceCompatibility = 11
targetCompatibility = 11
ext {
depVersion = [
commonsJava : "2.3.5",
commonsLang3 : "3.7",
confuse : "1.2.1",
confuseIoYaml : "1.0.0",
disruptor : "3.4.2",
dockerJava : "3.0.14",
grpc : "1.30.0",
guava : "28.1-jre",
log4j : "2.19.0",
mongooseBase : "4.3.3",
mongooseStorageDriverPreempt: "4.2.24",
netty : "4.1.45.Final",
nettyTcNative : "2.0.25.Final",
protobuf : "3.5.1",
scala : "2.12.6",
]
rootPkg = "com.emc.mongoose.storage.driver.pravega"
baseJarFileName = "mongoose"
javaHome = System.properties["java.home"]
jreOutputDir = "${project.buildDir}${File.separator}jre"
modulesDepsFilePath = "${project.buildDir}${File.separator}modules.deps"
buildLibsPath = "build${File.separator}libs"
pravegaSrcDir = "${project.buildDir}${File.separator}pravega"
pravegaDstDir = "${project.buildDir}${File.separator}pravega_"
pravegaClientJarDir = "${pravegaSrcDir}${File.separator}client${File.separator}${buildLibsPath}"
pravegaCommonJarDir = "${pravegaSrcDir}${File.separator}common${File.separator}${buildLibsPath}"
pravegaSharedAuthpluginJarDir = "${pravegaSrcDir}${File.separator}shared${File.separator}authplugin${File.separator}${buildLibsPath}"
pravegaSharedControllerApiJarDir = "${pravegaSrcDir}${File.separator}shared${File.separator}controller-api${File.separator}${buildLibsPath}"
pravegaSharedProtocolJarDir = "${pravegaSrcDir}${File.separator}shared${File.separator}protocol${File.separator}${buildLibsPath}"
}
wrapper {
gradleVersion = "4.10.3"
}
import org.ajoberstar.grgit.Grgit
task clonePravegaRepo {
doLast {
def destDir = file(pravegaSrcDir)
if(destDir.exists()) {
if(destDir.isDirectory()) {
if(0 < destDir.list().length) {
return
}
} else {
throw new GradleException("${pravegaSrcDir} is not a directory")
}
}
if(!destDir.exists()) {
def gitRepo = Grgit.clone {
uri = "https://github.com/pravega/pravega.git"
dir = pravegaSrcDir
}
gitRepo.reset {
commit = pravegaCommit
mode = "hard"
}
}
}
}
task pravegaClientJars(type: Exec, dependsOn: clonePravegaRepo) {
workingDir pravegaSrcDir
commandLine "./gradlew", "-PpravegaVersion=${pravegaVersion}", ":client:jar"
}
compileJava.dependsOn += pravegaClientJars
task pravegaDistInstall(type: Exec, dependsOn: clonePravegaRepo) {
workingDir pravegaSrcDir
commandLine "./gradlew", "-PpravegaVersion=${pravegaVersion}", "distribution", "install"
}
task pravegaExtract(dependsOn: pravegaDistInstall) {
doLast {
copy {
from tarTree("${pravegaSrcDir}${File.separator}build${File.separator}distributions${File.separator}pravega-${pravegaVersion}.tgz")
into project.buildDir
}
def pravegaDir = new File("${project.buildDir}${File.separator}pravega-${pravegaVersion}")
pravegaDir.renameTo(pravegaDstDir)
pravegaDir.deleteDir()
}
}
configurations {
all {
resolutionStrategy {
force("io.netty:netty-handler:${depVersion.netty}")
force("io.netty:netty-transport:${depVersion.netty}")
force("io.netty:netty-transport-native-epoll:${depVersion.netty}:linux-x86_64")
force("io.netty:netty-transport-native-kqueue:${depVersion.netty}:osx-x86_64")
force("io.netty:netty-transport-native-unix-common:${depVersion.netty}")
}
}
provided
testCompile {
extendsFrom(compileOnly, provided)
}
}
configurations.all {
exclude module: "slf4j-log4j12"
resolutionStrategy {
force "org.projectlombok:lombok:1.18.6"
}
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
dependencies {
compileOnly(
"org.projectlombok:lombok:1.18.6",
"com.github.emc-mongoose:mongoose-base:${depVersion.mongooseBase}",
"com.github.emc-mongoose:mongoose-storage-driver-preempt:${depVersion.mongooseStorageDriverPreempt}",
"com.github.akurilov:confuse:${depVersion.confuse}",
"com.github.akurilov:confuse-io-yaml:${depVersion.confuseIoYaml}",
"com.github.akurilov:java-commons:${depVersion.commonsJava}",
"org.apache.logging.log4j:log4j-api:${depVersion.log4j}",
)
provided(
files(
"${pravegaClientJarDir}${File.separator}pravega-client-${pravegaVersion}.jar",
"${pravegaCommonJarDir}${File.separator}pravega-common-${pravegaVersion}.jar",
"${pravegaSharedAuthpluginJarDir}${File.separator}pravega-shared-authplugin-${pravegaVersion}.jar",
"${pravegaSharedControllerApiJarDir}${File.separator}pravega-shared-controller-api-${pravegaVersion}.jar",
"${pravegaSharedProtocolJarDir}${File.separator}pravega-shared-protocol-${pravegaVersion}.jar",
),
"com.google.guava:guava:${depVersion.guava}",
"com.google.protobuf:protobuf-java:${depVersion.protobuf}",
"io.grpc:grpc-auth:${depVersion.grpc}",
"io.grpc:grpc-context:${depVersion.grpc}",
"io.grpc:grpc-netty:${depVersion.grpc}",
"io.grpc:grpc-protobuf:${depVersion.grpc}",
"io.grpc:grpc-stub:${depVersion.grpc}",
"io.netty:netty-handler:${depVersion.netty}",
"io.netty:netty-transport:${depVersion.netty}",
"io.netty:netty-transport-native-epoll:${depVersion.netty}:linux-x86_64",
"io.netty:netty-transport-native-kqueue:${depVersion.netty}:osx-x86_64",
"io.netty:netty-transport-native-unix-common:${depVersion.netty}",
"io.netty:netty-tcnative-boringssl-static:${depVersion.nettyTcNative}",
"org.apache.commons:commons-lang3:${depVersion.commonsLang3}",
)
testCompile(
"junit:junit:[4,)",
"com.github.docker-java:docker-java:[3,)",
"org.scala-lang:scala-compiler:${depVersion.scala}",
"org.scala-lang:scala-library:${depVersion.scala}",
"org.apache.commons:commons-csv:1.1",
)
testRuntime(
"com.lmax:disruptor:${depVersion.disruptor}",
)
}
test {
useJUnit()
exclude "com/emc/mongoose/storage/driver/pravega/integration/*"
jvmArgs "-XX:MaxDirectMemorySize=2g"
jvmArgs "-XX:+HeapDumpOnOutOfMemoryError"
maxHeapSize "2g"
testLogging {
events = [
"standardOut", "skipped", "started", "failed",
]
showExceptions = true
showStandardStreams = true
}
}
task integrationTest(type: Test) {
useJUnit()
include "com/emc/mongoose/storage/driver/pravega/integration/*"
jvmArgs "-XX:MaxDirectMemorySize=2g"
jvmArgs "-XX:+HeapDumpOnOutOfMemoryError"
maxHeapSize "2g"
testLogging {
events = [
"standardOut", "skipped", "started", "failed",
]
showExceptions = true
showStandardStreams = true
}
}
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
excludes = [
"**/*.css",
"**/*.html",
"**/*.png",
"**/*.proto",
"*.js",
"*.zip",
"META-INF/*.DSA",
"META-INF/*.LIST",
"META-INF/*.RSA",
"META-INF/*.SF",
"OSGI-INF/**",
"jquery/**",
"module-info.class",
]
manifest {
attributes(
"Automatic-Module-Name": rootPkg,
"Implementation-Title": project.name,
"Implementation-Version": project.version,
)
}
from configurations
.provided
.copyRecursive()
.collect {
zipTree(it)
}
}
javadoc {
failOnError = false
classpath += configurations.provided
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = "sources"
from sourceSets.main.allSource
}
// Maven Central deployment ////////////////////////////////////////////////////////////////////////////////////////////
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
nexusStaging {
packageGroup = project.group
username = project.hasProperty("ossrhUsername") ? project.property("ossrhUsername") : null
password = project.hasProperty("ossrhPassword") ? project.property("ossrhPassword") : null
numberOfRetries = 100
delayBetweenRetriesInMillis = 10000
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
groupId = project.group
artifact jar
artifact javadocJar
artifact sourcesJar
pom {
name = project.name
description = project.description
url = "https://github.com/emc-mongoose/mongoose-storage-driver-pravega"
scm {
connection = "https://github.com/emc-mongoose/mongoose-storage-driver-pravega.git"
developerConnection = "https://github.com/emc-mongoose/mongoose-storage-driver-pravega.git"
url = "https://github.com/emc-mongoose/mongoose-storage-driver-pravega.git"
}
licenses {
license {
name = "The MIT License (MIT)"
url = "https://github.com/emc-mongoose/mongoose-storage-driver-pravega/LICENSE"
}
}
developers {
developer {
id = "akurilov"
name = "Andrey Kurilov"
email = "[email protected]"
}
developer {
id = "dadlex"
name = "Alexander Aphonin"
email = "[email protected]"
}
developer {
id = "hoklet"
name = "Igor Konev"
email = "[email protected]"
}
developer {
id = "veronikaKochugova"
name = "Veronika Kochugova"
email = "[email protected]"
}
developer {
id = "vladislav-kulakovsky"
name = "Vladislav Kulakovsky"
email = "[email protected]"
}
developer {
id = "yurkov-anton"
name = "Anton Yurkov"
email = "[email protected]"
}
developer {
id = "zhenytim"
name = "Evgeny Timoshchuk"
email = "[email protected]"
}
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = project.hasProperty("ossrhUsername") ? project.property("ossrhUsername") : null
password = project.hasProperty("ossrhPassword") ? project.property("ossrhPassword") : null
}
}
}
}
signing {
sign publishing.publications
}
task releaseToMavenCentral {
dependsOn += publishToNexus
dependsOn += closeAndReleaseRepository
}
// Docker tasks ////////////////////////////////////////////////////////////////////////////////////////////////////////
import com.bmuschko.gradle.docker.tasks.image.*
import com.bmuschko.gradle.docker.tasks.container.*
task dockerBuildImage(type: DockerBuildImage) {
inputDir = project.projectDir
buildArgs = [
"BASE_VERSION" : depVersion.mongooseBase,
"STORAGE_DRIVER_PREEMPT_VERSION": depVersion.mongooseStorageDriverPreempt,
"VERSION" : version,
]
dockerFile = project.file("ci${File.separator}docker${File.separator}Dockerfile")
imageId = "emcmongoose/${project.name}".toString()
tags = [
"emcmongoose/${project.name}:${version}",
"emcmongoose/${project.name}:testing",
]
}
task dockerPushProductionImage(type: DockerPushImage) {
imageName = "emcmongoose/${project.name}".toString()
tag = "emcmongoose/${project.name}:${version}".toString()
}
task dockerPushTestingImage(type: DockerPushImage, dependsOn: dockerBuildImage) {
imageName = "emcmongoose/${project.name}".toString()
tag = "emcmongoose/${project.name}:testing".toString()
}
// Robot Framework /////////////////////////////////////////////////////////////////////////////////////////////////////
task dockerBuildImageRobotest(type: DockerBuildImage) {
inputDir = rootProject.projectDir
dockerFile = project.file("ci${File.separator}docker${File.separator}Dockerfile.robotest")
imageId = "emcmongoose/mongoose-robotest"
tags = [
"emcmongoose/mongoose-robotest:${version}",
]
}
task dockerCreateContainerRobotest(type: DockerCreateContainer, dependsOn: [dockerBuildImage, dockerBuildImageRobotest]) {
attachStderr = true
attachStdout = true
//autoRemove = true
binds = [
"${rootProject.buildDir}": "/root/mongoose/build",
"/var/run/docker.sock" : "/var/run/docker.sock",
]
envVars = [
"HOST_WORKING_DIR": rootProject.projectDir.absolutePath,
"BASE_VERSION" : depVersion.mongooseBase,
"VERSION" : version,
"SERVICE_HOST" : "localhost",
"SUITE" : System.getenv("SUITE"),
"TEST" : System.getenv("TEST"),
]
imageId = dockerBuildImageRobotest.getImageId()
network = "host"
tty = true
doLast {
println "Created the container for the ${System.env.SUITE}.${System.env.TEST} test"
}
}
task dockerStartContainerRobotest(type: DockerStartContainer, dependsOn: dockerCreateContainerRobotest) {
targetContainerId dockerCreateContainerRobotest.getContainerId()
}
task robotest(type: DockerWaitContainer, dependsOn: dockerStartContainerRobotest) {
targetContainerId dockerCreateContainerRobotest.getContainerId()
timeout = 600 // 10 min w/o output -> fail on Travis CI
doLast {
if(0 != exitCode) {
throw new GradleException("Some robotests FAILED")
} else {
println "Robotests PASSED"
}
}
}
// Code Formatting /////////////////////////////////////////////////////////////////////////////////////////////////////
spotless {
format "misc", {
target "**/*.gradle", "**/*.js", "**/*.groovy", "**/*.py", "**/*.scala"
indentWithTabs()
endWithNewline()
}
java {
target "**/*.java"
endWithNewline()
removeUnusedImports()
eclipse().configFile "spotless.eclipseformat.xml"
}
}