-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
209 lines (168 loc) · 7.1 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
id "io.spring.dependency-management" version "1.0.8.RELEASE"
id 'org.jetbrains.kotlin.jvm' version '1.3.70'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.70'
id "org.jetbrains.kotlin.plugin.jpa" version '1.3.70'
id 'jacoco'
id 'org.springframework.boot' version '2.2.2.RELEASE'
}
repositories {
mavenCentral()
jcenter()
}
apply from: 'git-hooks.gradle'
group = 'au.com.mir'
version = '1.0-SNAPSHOT'
apply plugin: 'kotlin'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java-library'
apply plugin: 'org.jetbrains.kotlin.plugin.spring'
apply plugin: 'jacoco'
repositories {
mavenCentral()
jcenter()
}
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:2.2.2.RELEASE")
}
dependencies {
dependency 'org.jetbrains.kotlin:kotlin-stdlib:1.3.70'
dependency 'org.jetbrains.kotlin:kotlin-reflect:1.3.70'
dependency 'org.junit.jupiter:junit-jupiter-api:5.3.1'
dependency 'io.springfox:springfox-swagger2:2.9.2'
dependency 'io.springfox:springfox-swagger-ui:2.9.2'
dependency('org.springframework.boot:spring-boot-starter-test:2.2.2.RELEASE') {
exclude group: 'org.junit', name: 'junit'
exclude group: 'org.mockito', name: 'mockito-core'
}
dependency 'org.spekframework.spek2:spek-dsl-jvm:2.0.5'
dependency 'org.spekframework.spek2:spek-runner-junit5:2.0.5'
dependency 'org.mockito:mockito-core:2.16.0'
dependency 'org.mockito:mockito-junit-jupiter:2.18.3'
dependency 'org.junit.jupiter:junit-jupiter-engine:5.3.1'
dependency 'org.codehaus.janino:janino:3.1.2'
dependency 'org.codehaus.janino:commons-compiler:3.1.2'
dependency 'net.logstash.logback:logstash-logback-encoder:6.3'
dependency 'org.springframework.boot:spring-boot-starter-data-jpa:2.2.2.RELEASE'
dependency 'org.apache.poi:poi-ooxml:4.1.2'
dependency 'com.vladmihalcea:hibernate-types-52:2.9.3'
}
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib',
'org.jetbrains.kotlin:kotlin-reflect'
compile 'net.logstash.logback:logstash-logback-encoder'
compile 'ch.qos.logback:logback-classic'
compile 'org.codehaus.janino:janino'
compile 'org.codehaus.janino:commons-compiler'
implementation'org.springframework.boot:spring-boot-starter-web',
'com.fasterxml.jackson.module:jackson-module-kotlin'
compile 'io.springfox:springfox-swagger2',
'io.springfox:springfox-swagger-ui'
testCompile 'org.springframework.security:spring-security-test'
compileOnly 'org.springframework.boot:spring-boot-starter-amqp'
testImplementation 'org.springframework.amqp:spring-rabbit-test'
implementation 'org.springframework:spring-context'
implementation 'org.springframework.boot:spring-boot-starter-amqp'
// Jackson
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
// Tests
testImplementation 'org.junit.jupiter:junit-jupiter-api'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit', module: 'junit'
exclude group: 'org.mockito', module: 'mockito-core'
}
testCompile 'org.spekframework.spek2:spek-dsl-jvm',
'org.spekframework.spek2:spek-runner-junit5'
testCompile 'org.mockito:mockito-core', 'org.mockito:mockito-junit-jupiter'
// spek requires kotlin-reflect, can be omitted if already in the classpath
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
}
compileJava {
sourceCompatibility = 11
targetCompatibility = 11
}
compileKotlin {
sourceCompatibility = 11
targetCompatibility = 11
kotlinOptions {
jvmTarget = '11'
}
}
compileTestKotlin {
sourceCompatibility = 11
targetCompatibility = 11
kotlinOptions {
jvmTarget = '11'
}
}
test {
beforeTest { descriptor ->
logger.lifecycle("Running test: ${descriptor}")
}
useJUnitPlatform()
}
apply from: './ktlint.gradle'
ktlint.dependsOn ktlintFormat
check.dependsOn ktlint
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
jacocoTestReport {
reports {
xml.enabled true
xml.destination file("${project.rootProject.buildDir}/reports/$project.name-jacocoTestReport.xml")
}
}
task coverage {
dependsOn jacocoTestReport
}
task resolveDependencies(group: "build setup", description: "Resolve and prefetch dependencies") {
doLast {
def resolve = {
ConfigurationContainer configurations ->
configurations
.findAll({ Configuration c -> c.isCanBeResolved() })
.each({ c -> c.resolve() })
}
project.rootProject.allprojects.each { subProject ->
resolve(subProject.buildscript.configurations)
resolve(subProject.configurations)
}
}
}