-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
304 lines (253 loc) · 9.03 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
import org.apache.tools.ant.filters.ReplaceTokens
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
buildscript {
ext {
springBootVersion = '2.1.3.RELEASE'
}
repositories {
jcenter()
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
}
}
plugins {
id "com.zoltu.git-versioning" version "3.0.3"
id 'pl.allegro.tech.build.axion-release' version '1.9.3'
id "de.undercouch.download" version "3.4.3"
id "com.avast.gradle.docker-compose" version "0.8.8"
id "com.palantir.graal" version "0.1.1-7-gdcfac74"
id "com.markklim.plugins.mfc" version "0.1.23"
}
apply plugin: 'base'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"
apply plugin: 'jacoco'
apply plugin: 'com.google.osdetector'
apply plugin: 'com.palantir.graal'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
ZoltuGitVersioning {
customDescribeProcessor { describeResults ->
def matcher = (describeResults =~ /[0-9A-Za-z.\-]*([0-9]+?)\.([0-9]+?)\.([0-9]+?)(?:-([0-9A-Za-z.\-]+))?-([0-9]+?)-g([a-zA-Z0-9]+)/)
matcher.matches()
[
major : matcher.group(1),
minor : matcher.group(2),
patch : matcher.group(3),
tags : matcher.group(4),
commitCount: matcher.group(5),
sha : matcher.group(6),
]
}
}
jacoco {
toolVersion = "0.8.2"
}
ext {
buildNumber = System.getenv().BUILD_NUMBER
versionInfo = ZoltuGitVersioning.versionInfo
currentDate = DateTimeFormatter.ISO_LOCAL_DATE.format(LocalDateTime.now())
versionProperties = [
version : version,
buildNumber: buildNumber ?: 'dev',
commitHash : versionInfo.sha,
buildDate : currentDate
]
platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os
isOsLinux = osdetector.os == 'linux'
dockerComposeCacheDir = "$rootDir/.gradle/docker-compose"
dockerComposeScript = isOsLinux ? "$dockerComposeCacheDir/$dockerComposeVersion/docker-compose.sh"
: "$dockerComposeCacheDir/$dockerComposeVersion/docker-compose.exe"
dockerComposeCommand = project.hasProperty('dockerComposeVersion') ?
dockerComposeScript : 'docker-compose'
composeProperties = [
'version' : project.version,
]
jsr305Version="3.1.11"
lombokVersion="edge-SNAPSHOT"
openFxVersion="11.0.1"
}
repositories {
jcenter()
maven { url 'https://projectlombok.org/edge-releases' }
maven { url 'https://repo.spring.io/snapshot' }
}
graal {
outputName 'cassandra-client'
mainClass 'com.github.kindrat.cassandra.client.CassandraClientGUI'
}
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion") {
bomProperty 'reactor-bom.version', 'Californium-SR5'
}
}
dependencies {
// cassandra driver depends on old guava futures
dependency("com.google.guava:guava:19.0")
}
}
dependencies {
compile("org.springframework.boot:spring-boot-starter")
compile("com.google.guava:guava")
compile("com.github.nginate:commons-lang:1.0.0")
compile("com.fasterxml.jackson.core:jackson-databind")
compile("org.hibernate:hibernate-core")
compile("org.apache.commons:commons-csv:1.6")
compile("io.projectreactor:reactor-core")
compile("org.openjfx:javafx-controls:$openFxVersion:$platform")
compile("org.openjfx:javafx-fxml:$openFxVersion:$platform")
compile("org.openjfx:javafx-base:$openFxVersion:$platform")
compile("org.openjfx:javafx-graphics:$openFxVersion:$platform")
compile("org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:2.0.0.Alpha1")
annotationProcessor("org.projectlombok:lombok:$lombokVersion")
implementation("org.projectlombok:lombok:$lombokVersion")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
annotationProcessor("net.jcip:jcip-annotations:1.0")
annotationProcessor("com.github.spotbugs:spotbugs-annotations:$jsr305Version")
implementation("com.github.spotbugs:spotbugs-annotations:$jsr305Version")
compile("com.datastax.cassandra:cassandra-driver-core:3.1.3")
compile("org.springframework.data:spring-data-cassandra") {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
runtime("org.codehaus.janino:janino")
testCompile("org.springframework.boot:spring-boot-starter-data-cassandra")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("io.projectreactor:reactor-test")
testCompile("org.testng:testng:6.14.3")
}
scmVersion {
versionIncrementer 'incrementMinorIfNotOnRelease', [releaseBranchPattern: 'release-.*']
}
wrapper {
gradleVersion = '4.10.2'
distributionType = "all"
}
bootRun {
systemProperties System.properties
mainClassName = "com.github.kindrat.cassandra.client.Java11Starter"
systemProperties.remove("java.endorsed.dirs")
}
jar {
enabled = true
manifest {
attributes(
'Main-Class': 'com.github.kindrat.cassandra.client.Java11Starter'
)
}
}
bootJar {
mainClassName = 'com.github.kindrat.cassandra.client.Java11Starter'
// this is here to enable incremental build
classifier = 'exec'
}
task downloadDockerCompose(type: Download) {
def composeVersion = project.findProperty('dockerComposeVersion')
def composeSrc = isOsLinux ? "https://github.com/docker/compose/releases/download/$composeVersion/docker-compose-linux-x86_64"
: "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Windows-x86_64.exe"
inputs.property('composeVersion', composeVersion)
overwrite false
src composeSrc
dest dockerComposeScript
onlyIf { composeVersion != null }
doFirst { delete(dockerComposeCacheDir) }
doLast { file(dockerComposeScript).executable = true }
}
task prepareDockerFiles(type: Sync, group: 'docker') {
inputs.properties composeProperties
from("docker-compose") {
filter(ReplaceTokens, tokens: composeProperties)
}
into "$buildDir/docker-compose"
}
dockerCompose.env {
projectName = dockerComposeProject
dockerComposeWorkingDirectory = "$buildDir/docker-compose"
useComposeFiles = ['docker-compose.yml']
executable = dockerComposeCommand
removeVolumes = true
waitForTcpPorts = true
}
envComposePull {
group = 'docker'
dependsOn ":downloadDockerCompose", prepareDockerFiles
}
envComposeDown {
group = 'docker'
dependsOn ":downloadDockerCompose", prepareDockerFiles
}
envComposeUp {
group = 'docker'
dependsOn ":downloadDockerCompose", prepareDockerFiles
}
migrator {
host = "127.0.0.1"
port = 19042
keyspace = "test"
script = "${rootDir}/init_cassandra.cql"
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
compileJava {
options.encoding = 'UTF-8'
doFirst {
options.compilerArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls',
"-Xlint:unchecked",
"-Xlint:deprecation"
]
}
}
run {
mainClassName = "com.github.kindrat.cassandra.client.Java11Starter"
doFirst {
jvmArgs = [
'--module-path', classpath.asPath,
'--add-modules', 'javafx.controls'
]
}
}
task codeCoverageReport(type: JacocoReport) {
dependsOn test
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
sourceSets sourceSets.main
reports {
xml.setEnabled(true)
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.setEnabled(false)
csv.setEnabled(false)
}
}
tasks.withType(Test) {
useTestNG()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
stackTraceFilters = []
showStandardStreams = true
}
systemProperties System.properties
systemProperty 'user.dir', workingDir
systemProperty 'functional.logDir', "${project.buildDir}/test-reports/container-logs"
//Mac OS default TMPDIR env variable points to folder which is not mounted to Docker VM,
//this fixes mounting temporary files/folders to containers
if (Os.isFamily(Os.FAMILY_MAC)) {
systemProperty 'java.io.tmpdir', "/tmp"
}
systemProperties.remove("java.endorsed.dirs")
}
migratorDropKeyspace.dependsOn envComposeUp
migratorExecute.dependsOn envComposeUp
test.dependsOn migratorExecute
test.finalizedBy envComposeDown