-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.gradle
245 lines (220 loc) · 9.38 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
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.2"
classpath "io.spring.gradle:dependency-management-plugin:1.0.5.RELEASE"
classpath 'au.com.dius:pact-jvm-provider-gradle_2.12:3.6.2'
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2"
}
}
ext {
axonVersion = '4.0.3'
aspectjVersion = '1.9.1'
junitVersion = '5.3.2'
mockitoVersion = '2.24.5'
projectVersion = '1.0.4'
lombokVersion = '1.18.6'
}
subprojects { parentProject ->
subprojects { project ->
apply plugin: "java"
apply plugin: "io.spring.dependency-management"
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'groovy'
apply plugin: "com.github.kt3k.coveralls"
sourceCompatibility = 1.8
targetCompatibility = 1.8
if(parentProject.name.equals('domain-services')) {
apply plugin: "application"
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'au.com.dius.pact'
shadowJar {
mergeServiceFiles()
}
run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1')
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
}
repositories {
mavenLocal()
jcenter()
}
dependencyManagement {
imports {
mavenBom "io.micronaut:micronaut-bom:$projectVersion"
}
}
dependencies {
compile("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
annotationProcessor "io.micronaut:micronaut-inject-java"
annotationProcessor "io.micronaut:micronaut-validation"
annotationProcessor "io.micronaut.configuration:micronaut-openapi"
compile "io.micronaut.configuration:micronaut-openapi"
compile "io.micronaut:micronaut-inject"
compile "io.micronaut:micronaut-validation"
compile "io.micronaut:micronaut-runtime"
compile "io.micronaut:micronaut-http-client"
compile "javax.annotation:javax.annotation-api"
compile "io.micronaut:micronaut-http-server-netty"
compileOnly "io.micronaut:micronaut-inject-java"
compile "io.micronaut:micronaut-discovery-client"
compile "io.swagger.core.v3:swagger-annotations"
compile "io.micronaut.configuration:micronaut-hibernate-validator"
if(parentProject.name.equals('domain-services')) {
compile "au.com.dius:pact-jvm-consumer-junit5_2.12:3.6.2"
runtime "ch.qos.logback:logback-classic:1.2.3"
}
runtime "io.micronaut:micronaut-management"
testCompile "io.micronaut:micronaut-inject-java"
testCompile "org.hamcrest:hamcrest-all:1.3"
testCompile "org.assertj:assertj-core:3.12.1"
testCompile 'io.rest-assured:rest-assured:3.3.0'
testCompile "io.micronaut.test:micronaut-test-junit5:1.0.2"
testCompile "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
testCompile "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
}
tasks.withType(Test) {
maxParallelForks = 1 //Runtime.runtime.availableProcessors()
}
checkstyle {
configFile = new File(rootDir, "checkstyles.xml")
}
checkstyleTest {
source = fileTree('src/test') {
excludes =
['*.yml']
}
}
jacoco {
toolVersion = "0.8.2"
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
executionData = files(jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
html.destination = "./coverage/"
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: [
'**/configuration/**',
'**/repositories/**',
'**/events/**',
'**/exceptions/**',
'**/commands/**',
'**/models/**',
'**/Application'
]
)
})
}
}
coveralls {
sourceDirs = files(sourceSets.main.allSource.srcDirs).files.absolutePath
}
if(parentProject.name.equals('domain-services')) {
task clearPactBroker() {
doLast() {
def services = ['AccountCmd', 'AccountQuery', 'AccountTransactions', 'PeopleDetails']
for (service in services) {
println "http://localhost:8089/pacticipants/" + service
def p = ['curl', '-X', 'DELETE', "http://localhost:8089/pacticipants/" + service].
execute()
println p.text
}
}
}
pact {
serviceProviders {
// You can define as many as you need, but each must have a unique name
AccountCmd {
// All the provider properties are optional, and have sensible defaults (shown below)
protocol = 'http'
host = 'localhost'
port = 8082
path = '/'
if ('pactVerify' in gradle.startParameter.taskNames) {
hasPactsFromPactBroker('http://localhost:8089')
}
}
AccountQuery {
// All the provider properties are optional, and have sensible defaults (shown below)
protocol = 'http'
host = 'localhost'
port = 8084
path = '/'
if ('pactVerify' in gradle.startParameter.taskNames) {
hasPactsFromPactBroker('http://localhost:8089')
}
}
PeopleDetails {
// All the provider properties are optional, and have sensible defaults (shown below)
protocol = 'http'
host = 'localhost'
port = 8085
path = '/'
if ('pactVerify' in gradle.startParameter.taskNames) {
hasPactsFromPactBroker('http://localhost:8089')
}
}
AccountTransactions {
// All the provider properties are optional, and have sensible defaults (shown below)
protocol = 'http'
host = 'localhost'
port = 8086
path = '/'
if ('pactVerify' in gradle.startParameter.taskNames) {
hasPactsFromPactBroker('http://localhost:8089')
}
}
}
publish {
def folder = new File('./tests/pact-tests')
if (folder.exists()) {
pactDirectory = './tests/pact-tests'
} else if ((new File('../tests/pact-tests')).exists()) {
pactDirectory = '../tests/pact-tests'
} else {
pactDirectory = '../../tests/pact-tests'
}
pactBrokerUrl = 'http://localhost:8089'
}
}
}
test {
useJUnitPlatform()
systemProperties['pact.rootDir'] = "../../tests/pact-tests"
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
//test.finalizedBy(jacocoTestCoverageVerification)
}
}