-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
328 lines (293 loc) · 8.71 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
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
plugins {
id "java"
id "scala"
id "signing"
id "maven-publish"
id "com.bmuschko.docker-remote-api" version "6.4.0"
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"
}
repositories {
jcenter()
mavenCentral()
}
description = "Mongoose is a high-load storage performance testing tool"
group = "com.github.emc-mongoose"
version = "4.2.13"
sourceCompatibility = 11
targetCompatibility = 11
ext {
depVersion = [
commonsCodec : "1.11",
confuse : "1.2.1",
confuseIoYaml : "1.0.0",
disruptor : "3.4.2",
fiber4j : "1.1.0",
javaCommons : "2.3.6",
junit : "4.12",
log4j : "2.19.0",
mongooseBase : "4.3.3",
mongooseStorageDriverCoop: "4.2.21",
mongooseStorageDriverNio: "4.2.13",
scala : "2.12.6",
slf4j : "1.7.25",
]
rootPkg = "com.emc.mongoose.storage.driver.coop.nio.fs"
baseJarFileName = "mongoose"
javaHome = System.properties["java.home"]
jreOutputDir = "${project.buildDir}${File.separator}jre"
modulesDepsFilePath = "${project.buildDir}${File.separator}modules.deps"
}
wrapper {
gradleVersion = "6.4"
}
configurations {
provided
testCompile {
extendsFrom(compileOnly, provided)
}
}
sourceSets {
main {
compileClasspath += configurations.provided
}
}
dependencies {
compileOnly(
"com.github.emc-mongoose:mongoose-base:${depVersion.mongooseBase}",
"com.github.emc-mongoose:mongoose-storage-driver-coop:${depVersion.mongooseStorageDriverCoop}",
"com.github.emc-mongoose:mongoose-storage-driver-nio:${depVersion.mongooseStorageDriverNio}",
"com.github.akurilov:confuse:${depVersion.confuse}",
"com.github.akurilov:confuse-io-yaml:${depVersion.confuseIoYaml}",
"com.github.akurilov:java-commons:${depVersion.javaCommons}",
"org.apache.logging.log4j:log4j-api:${depVersion.log4j}",
"org.apache.logging.log4j:log4j-core:${depVersion.log4j}",
)
testCompile(
"junit:junit:${depVersion.junit}",
"org.scala-lang:scala-compiler:${depVersion.scala}",
"org.scala-lang:scala-library:${depVersion.scala}",
"com.github.docker-java:docker-java:[3,)",
)
testRuntime(
"commons-codec:commons-codec:${depVersion.commonsCodec}",
"com.github.akurilov:confuse-io-yaml:${depVersion.confuseIoYaml}",
"com.github.akurilov:fiber4j:${depVersion.fiber4j}",
"com.lmax:disruptor:${depVersion.disruptor}",
)
}
test {
useJUnit()
exclude "com/emc/mongoose/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/integration/*"
exclude "**/RollingAppenderTest*"
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",
"META-INF/*.DSA",
"META-INF/*.LIST",
"META-INF/*.RSA",
"META-INF/*.SF",
"OSGI-INF/*",
"module-info.class",
]
manifest {
attributes(
"Automatic-Module-Name": rootPkg,
"Implementation-Title": project.name,
"Implementation-Version": project.version,
)
}
from configurations.provided.collect {
it.isDirectory() ? it : 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
//stagingProfileId = "491ac45c9daed9"
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-fs"
scm {
connection = "https://github.com/emc-mongoose/mongoose-storage-driver-fs.git"
developerConnection = "https://github.com/emc-mongoose/mongoose-storage-driver-fs.git"
url = "https://github.com/emc-mongoose/mongoose-storage-driver-fs.git"
}
licenses {
license {
name = "The MIT License (MIT)"
url = "https://github.com/emc-mongoose/mongoose-storage-driver-fs/LICENSE"
}
}
developers {
developer {
id = "akurilov"
name = "Andrey Kurilov"
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_COOP_VERSION": depVersion.mongooseStorageDriverCoop,
"STORAGE_DRIVER_NIO_VERSION": depVersion.mongooseStorageDriverNio,
"VERSION": version,
]
dockerFile = project.file("ci${File.separator}docker${File.separator}Dockerfile")
images.add("emcmongoose/${project.name}:${version}")
images.add("emcmongoose/${project.name}:testing")
}
task dockerPushProductionImage(type: DockerPushImage, dependsOn: dockerBuildImage) {
images.add("emcmongoose/${project.name}:${version}")
}
task dockerPushTestingImage(type: DockerPushImage, dependsOn: dockerBuildImage) {
images.add("emcmongoose/${project.name}:testing")
}
// Robot Framework /////////////////////////////////////////////////////////////////////////////////////////////////////
task dockerBuildImageRobotest(type: DockerBuildImage) {
inputDir = project.projectDir
dockerFile = project.file("ci${File.separator}docker${File.separator}Dockerfile.robotest")
images.add("emcmongoose/${project.name}-robotest:${version}")
}
task dockerCreateContainerRobotest(type: DockerCreateContainer, dependsOn: [dockerBuildImage, dockerBuildImageRobotest]) {
attachStderr = true
attachStdout = true
hostConfig.autoRemove = true
hostConfig.binds = [
"${project.buildDir}": "/root/mongoose/build",
"/var/run/docker.sock": "/var/run/docker.sock",
]
envVars = [
"HOST_WORKING_DIR": projectDir.absolutePath,
"MONGOOSE_VERSION": version,
"MONGOOSE_IMAGE_VERSION": version,
"SERVICE_HOST": "localhost",
"SUITE": System.getenv("SUITE"),
"TEST": System.getenv("TEST"),
]
imageId = dockerBuildImageRobotest.getImageId()
hostConfig.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()
awaitStatusTimeout = 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"
}
}