-
Notifications
You must be signed in to change notification settings - Fork 315
/
build.gradle
272 lines (230 loc) · 7.78 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
plugins {
id 'io.spring.dependency-management'
id 'org.springframework.boot' version '2.3.1.RELEASE'
id 'org.jetbrains.kotlin.jvm'
id 'kotlin-spring'
id 'kotlin-jpa'
id 'kotlin-allopen'
id 'org.asciidoctor.convert' version "1.5.9.2"
id 'jacoco'
id 'antlr'
}
group = 'com.mlreef'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
implementation "org.projectlombok:lombok"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.10"
implementation "org.springframework.boot:spring-boot-devtools"
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation "org.springframework.boot:spring-boot-starter-aop"
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
// Rest and HATEOAS
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'org.springframework.boot:spring-boot-starter-web'
// Security
implementation "org.springframework.boot:spring-boot-starter-security"
implementation "org.springframework.session:spring-session-data-redis"
// implementation "org.springframework.boot:spring-boot-starter-oauth2-client"
// spring data, JPA, Repositories and DB migration
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation "org.flywaydb:flyway-core"
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly 'redis.clients:jedis:3.3.0'
runtimeOnly 'com.h2database:h2'
//Social
implementation 'com.github.scribejava:scribejava-core:8.3.1'
implementation 'com.github.scribejava:scribejava-apis:8.3.1'
//External drives
implementation 'com.amazonaws:aws-java-sdk:1.12.21'
// parsing python files with ANTLR
antlr 'org.antlr:antlr4:4.7.2'
implementation 'org.antlr:antlr4-runtime:4.7.2'
//Email
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
//WebFlux
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("io.projectreactor.netty:reactor-netty")
def jupiter = "5.6.2"
def mockkVersion = "1.10.2"
testImplementation "org.junit.jupiter:junit-jupiter:$jupiter"
// DO NOT USE: testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiter"
// DO NOT USE: testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiter"
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: "org.junit.vintage", module: "junit-vintage-engine"
exclude group: 'junit', module: 'junit' //by both name and group
exclude group: 'mockito', module: 'mockito-core' //by both name and group
}
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.springframework.restdocs:spring-restdocs-mockmvc"
testImplementation "io.mockk:mockk:${mockkVersion}"
testImplementation "com.ninja-squad:springmockk:2.0.1"
asciidoctor 'org.springframework.restdocs:spring-restdocs-asciidoctor'
// testcontainers
testImplementation "org.testcontainers:testcontainers:1.15.1"
testImplementation "org.testcontainers:postgresql:1.15.1"
//ebedded servers
testImplementation "com.github.kstyrc:embedded-redis:0.6"
testImplementation "org.eclipse.jgit:org.eclipse.jgit:5.8.1.202007141445-r"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
noArg {
annotation("com.mlreef.rest.api.Dto")
annotation("com.mlreef.rest.api.DtoRequest")
}
ext {
snippetsDir = file('build/generated-snippets')
jacocoMerged = "$buildDir/jacoco/jacocoTest.exec"
}
sourceSets {
sourceSets.main.java.srcDir new File("build/generated-src/")
test {
kotlin {
srcDir "$projectDir/test/kotlin"
exclude "$projectDir/test/kotlin/com/mlreef/rest/integration/**"
}
}
integrationTest {
kotlin.srcDir "$projectDir/test/kotlin/com/mlreef/rest/integration"
resources.srcDir "$projectDir/test/resources"
}
}
task allTests(type: Test) {
useJUnitPlatform {
includeTags 'any() | all()'
}
finalizedBy jacocoTestReport
}
task integrationTest(type: Test) {
useJUnitPlatform {
includeTags 'integration'
}
finalizedBy jacocoTestReport
jacoco {
// append = true
destinationFile = file("$jacocoMerged")
}
}
tasks.withType(Test) {
testLogging {
// events "started", "passed", "skipped", "failed"
exceptionFormat = 'full'
}
systemProperty 'junit.jupiter.extensions.autodetection.enabled', 'true'
afterTest { descriptor, result ->
println "$descriptor.classDisplayName > $descriptor.displayName: $result.resultType"
}
}
test {
outputs.dir snippetsDir
finalizedBy jacocoTestReport
useJUnitPlatform {
excludeTags 'slow', 'system'
}
jacoco {
// append = true
destinationFile = file("$jacocoMerged")
}
}
//integrationTest {
// jacoco {
// append = true
// destinationFile = file("$jacocoMerged")
// }
//}
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
bootJar {
enabled = true
mainClassName = 'com.mlreef.rest.RestApplicationKt'
dependsOn asciidoctor
from("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
jar {
enabled = true
zip64 = true
}
task fatJar(type: Jar) {
manifest.from jar.manifest
zip64 = true
from {
configurations.testRuntime.collect { it.isDirectory() ? it : zipTree(it) }
} {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
with jar
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled true
html.enabled = true
}
}
task explodeJar(type: Copy) {
dependsOn ":mlreef-rest:bootJar"
mustRunAfter ":mlreef-rest:bootJar"
from(zipTree(tasks.bootJar.outputs.files.singleFile))
into("build/dependency")
}
task prepareDocker {
dependsOn ":mlreef-rest:bootJar"
dependsOn ":mlreef-rest:explodeJar"
mustRunAfter ":mlreef-rest:explodeJar"
doLast {
print("Exploded Jar for docker")
}
}
task coverageReport() {
dependsOn jacocoTestReport
def reportFile = project.file("build/reports/jacoco/test/jacocoTestReport.xml")
inputs.file(reportFile)
doLast {
def slurper = new XmlSlurper()
slurper.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
slurper.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
def xml = slurper.parse(reportFile)
def counter = xml.counter.find {
node -> node.@type == 'BRANCH'
}
def missed = counter.@missed.toDouble()
def covered = counter.@covered.toDouble()
def total = missed + covered
def percentage = covered / total * 100
printf "Coverage: Missed %.0f branches%n", missed
printf "Covered %.0f branches%n", covered
printf "Total %.0f%%%n", percentage
printf "Coverage: Total %.0f%%%n", percentage
}
}
generateGrammarSource {
maxHeapSize = "64m"
arguments += ["-visitor"]
outputDirectory = file("build/generated-src/com/mlreef/antlr")
}
compileKotlin.dependsOn generateGrammarSource
allOpen {
annotation("javax.persistence.Entity")
annotation("javax.persistence.MappedSuperclass")
annotation("javax.persistence.Embeddable")
}