forked from buildit/bookit-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
250 lines (210 loc) · 7.56 KB
/
Copy pathbuild.gradle
File metadata and controls
250 lines (210 loc) · 7.56 KB
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
buildscript {
// these override spring boot defaults
// find defaults here -
// 1.5.x - https://github.com/spring-projects/spring-boot/blob/1.5.x/spring-boot-dependencies/pom.xml
// master - https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot-dependencies/pom.xml
// double check version of spring boot
ext['hibernate.version'] = '5.2.14.Final'
ext['jackson.version'] = '2.9.4'
ext['mariadb.version'] = '2.2.2'
ext['h2.version'] = '1.4.196'
ext['junit-jupiter.version'] = '5.1.0'
ext['junit-platform.version'] = '1.1.0'
ext['mockito.version'] = '2.15.0'
// these are our additions (some become defaults in spring boot 2.x)
ext['expekt.version'] = '0.5.0'
ext['hamkrest.version'] = '1.4.2.2'
ext['springfox.version'] = '2.8.0'
ext['mockito-kotlin.version'] = '1.5.0'
ext['jacoco.version'] = '0.8.0'
ext['threeten.version'] = '1.3.2'
ext['ktlint.version'] = '0.18.0'
ext['nimbus-jose-jwt.version'] = '5.5'
ext['detekt.version'] = '1.0.0.RC6-3'
repositories {
mavenCentral()
}
configurations.classpath {
resolutionStrategy { force "com.github.shyiko:ktlint:${property('ktlint.version')}" }
}
dependencies {
classpath("org.junit.platform:junit-platform-gradle-plugin:${property('junit-platform.version')}")
classpath 'com.kncept.junit5.reporter:junit-reporter:1.1.0'
}
}
plugins {
id 'org.springframework.boot' version '1.5.12.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.2.50'
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.50'
id 'org.jetbrains.kotlin.plugin.jpa' version '1.2.50'
id 'org.jmailen.kotlinter' version '1.8.1'
// id 'com.gorylenko.gradle-git-properties' version '1.4.17'
id 'io.gitlab.arturbosch.detekt' version '1.0.0.RC6-3'
}
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
}
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'com.kncept.junit5.reporter'
group = 'com.buildit'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
sourceSets {
'test-e2e' {
kotlin {
srcDir files('src/test-e2e/kotlin')
}
resources.srcDir files('src/test-e2e/resources')
}
}
idea {
module {
testSourceDirs += files('src/test-e2e/kotlin')
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
allWarningsAsErrors = true
}
}
repositories {
mavenCentral()
}
springBoot {
buildInfo()
}
bootRun {
addResources = true
}
configurations {
testE2eCompile.extendsFrom testCompile
testE2eRuntime.extendsFrom testRuntime
}
kotlinter {
continuationIndentSize = 4
}
detekt {
version = "${property('detekt.version')}"
profile("main") {
input = "$projectDir/src"
config = "$projectDir/detekt.yml"
output = "$buildDir/reports/detekt"
}
}
check.dependsOn detektCheck
detektCheck.shouldRunAfter lintKotlin
lintKotlin.shouldRunAfter compileTestKotlin
junitPlatform {
platformVersion property('junit-platform.version')
}
junitPlatformTest.shouldRunAfter detektCheck
afterEvaluate {
jacoco {
applyTo junitPlatformTest
toolVersion = property('jacoco.version')
}
task junit5CodeCoverageReport(type: JacocoReport) {
executionData junitPlatformTest
sourceSets sourceSets.main
sourceDirectories = files(project.sourceSets.main.allSource.srcDirs)
classDirectories = files(files(project.sourceSets.main.output).collect {
fileTree(dir: it, exclude: [
'**/dto'
])
})
reports {
xml.enabled = true
html.enabled = true
}
}
task junit5CodeCoverageVerification(type: JacocoCoverageVerification) {
executionData junitPlatformTest
sourceSets sourceSets.main
sourceDirectories = files(project.sourceSets.main.allSource.srcDirs)
classDirectories = files(files(project.sourceSets.main.output).collect {
fileTree(dir: it, exclude: [
'**/dto'
])
})
violationRules {
rule {
limit {
minimum = 0.75
}
}
}
}
test.dependsOn junit5CodeCoverageReport
// can't really enforce this until we have a way to ignore data classes and the things they generate
// https://github.com/jacoco/jacoco/issues/552
check.dependsOn junit5CodeCoverageVerification
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")
//spring boot
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
// security
compile('org.springframework.boot:spring-boot-starter-security')
compile("com.nimbusds:nimbus-jose-jwt:${property('nimbus-jose-jwt.version')}")
// for kotlin data classes
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8")
compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
// swagger
compile("io.springfox:springfox-swagger2:${property('springfox.version')}")
compile("io.springfox:springfox-bean-validators:${property('springfox.version')}")
compile("io.springfox:springfox-swagger-ui:${property('springfox.version')}")
//database
compile("com.h2database:h2")
compile("org.mariadb.jdbc:mariadb-java-client") // dropin replacement for mysql with aurora support
// joda time concepts left out of java.time apis
compile("org.threeten:threeten-extra:${property('threeten.version')}")
compileOnly('org.springframework.boot:spring-boot-configuration-processor')
runtime('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'junit', module: 'junit'
}
testCompile("org.springframework.security:spring-security-test")
testCompile("com.winterbe:expekt:${property('expekt.version')}")
testCompile("org.junit.jupiter:junit-jupiter-api:${property('junit-jupiter.version')}")
testCompile("com.natpryce:hamkrest:${property('hamkrest.version')}")
testCompile("com.nhaarman:mockito-kotlin:${property('mockito-kotlin.version')}")
testCompile("com.github.sbrannen:spring-test-junit5:1.0.0")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${property('junit-jupiter.version')}")
testRuntime("org.junit.platform:junit-platform-console:${property('junit-platform.version')}")
}
// https://stackoverflow.com/questions/45297339/junit-5-under-gradle-with-multiple-source-sets
task 'test-e2e'(
type: JavaExec,
description: 'Runs the e2e tests.',
group: 'Verification'
) {
dependsOn testE2eClasses
finalizedBy 'junitHtmlReport'
outputs.upToDateWhen { false }
classpath = sourceSets.'test-e2e'.runtimeClasspath
main = 'org.junit.platform.console.ConsoleLauncher'
args = ['--scan-class-path',
sourceSets.'test-e2e'.output.getClassesDirs().asPath,
'--reports-dir', "${buildDir}/test-results/test-e2e"]
}