-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
158 lines (131 loc) · 4.01 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
plugins {
id 'org.springframework.boot' version '2.4.5'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'org.openapi.generator' version '5.1.1'
id 'java'
id 'jacoco'
}
ext {
cucumberVersion = '6.10.3'
swaggerVersion = '2.9.2'
}
apply plugin: 'org.openapi.generator'
apply plugin: 'jacoco'
group = 'org.k9m.kalah'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
configurations {
developmentOnly
runtimeClasspath {
extendsFrom developmentOnly
}
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation("io.springfox:springfox-swagger2:$swaggerVersion")
implementation("io.springfox:springfox-swagger-ui:$swaggerVersion")
implementation("org.openapitools:jackson-databind-nullable:0.2.1")
compileOnly 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation group: "de.flapdoodle.embed", name: "de.flapdoodle.embed.mongo"
testImplementation group : 'org.junit.platform', name : 'junit-platform-console'
testImplementation group : 'io.cucumber', name : 'cucumber-java', version: cucumberVersion
testImplementation group : 'io.cucumber', name : 'cucumber-junit-platform-engine', version: cucumberVersion
testImplementation group : 'io.cucumber', name : 'cucumber-spring', version: cucumberVersion
}
openApiValidate {
inputSpec = "$rootDir/src/main/resources/contract.yml".toString()
}
openApiGenerate {
generatorName = "spring"
inputSpec = "$rootDir/src/main/resources/contract.yml"
outputDir = "$buildDir/generated-sources"
apiPackage = "org.k9m.kalah.api"
modelPackage = "org.k9m.kalah.api.model"
configOptions = [
dateLibrary: "java8",
interfaceOnly: "true",
swaggerDocketConfig: "false",
configPackage: "org.k9m.kalah.api.config",
java8: "true"
]
logToStderr = true
}
task openApiGenerateTestClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName = "java"
library = "resttemplate"
inputSpec = "$rootDir/src/main/resources/contract.yml"
outputDir = "$buildDir/generated-test-sources"
apiPackage = "org.k9m.kalah.api"
modelPackage = "org.k9m.kalah.api.model"
generateApiTests = false
generateModelTests = false
supportingFilesConstrainedTo = [""]
apiFilesConstrainedTo = [""]
configOptions = [
dateLibrary: "java8",
generateModels: "false",
interfaceOnly: "true",
exceptionHandler : "false",
swaggerDocketConfig: "false",
configPackage: "org.k9m.kalah.api.config",
java8: "true"
]
}
task itTests(type: JavaExec) {
dependsOn(testClasses)
outputs.dir(file("$buildDir/test-results"))
classpath = sourceSets["test"].runtimeClasspath
main = "org.junit.platform.console.ConsoleLauncher"
args("--scan-classpath")
args("--include-engine", "cucumber")
args("--reports-dir", file("$buildDir/test-results"))
finalizedBy jacocoTestReport
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
showStandardStreams = true
}
finalizedBy itTests
}
jacoco {
toolVersion = "0.8.7"
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
csv.enabled true
html.enabled true
html.destination file("${buildDir}/jacoco-reports")
}
}
sourceSets {
main {
java {
srcDir 'build/generated-sources/src/main/java'
}
}
test {
java {
srcDir 'build/generated-test-sources/src/main/java'
}
}
}
compileJava.dependsOn tasks.openApiValidate,tasks.openApiGenerate,tasks.openApiGenerateTestClient