generated from hmcts/spring-boot-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
708 lines (590 loc) · 24.5 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
plugins {
id 'application'
id 'checkstyle'
id 'pmd'
id 'jacoco'
id 'idea'
id "io.freefair.lombok" version "8.12.2.1"
id 'io.spring.dependency-management' version '1.1.7'
id 'org.springframework.boot' version '3.4.3'
id 'org.owasp.dependencycheck' version '12.1.0'
id 'com.github.ben-manes.versions' version '0.52.0'
id 'org.sonarqube' version '6.0.1.5171'
id 'java-library'
id "org.openapi.generator" version "7.12.0"
id("com.github.bjornvester.wsdl2java") version "2.0.2"
}
import static groovy.io.FileType.FILES
group = 'uk.gov.hmcts'
version = '0.0.1'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
configurations.all {
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on' // bcprov-jdk15on-1.69.jar CVE-2023-33201
exclude group: 'org.bouncycastle', module: 'bcutil-jdk15on'
resolutionStrategy.capabilitiesResolution.withCapability('org.codehaus.groovy:groovy-json') {
selectHighestVersion()
}
resolutionStrategy.capabilitiesResolution.withCapability('org.codehaus.groovy:groovy-xml') {
selectHighestVersion()
}
resolutionStrategy.capabilitiesResolution.withCapability('org.codehaus.groovy:groovy-jso') {
selectHighestVersion()
}
resolutionStrategy.capabilitiesResolution.withCapability('org.codehaus.groovy:groovy') {
selectHighestVersion()
}
}
configurations {
jaxb
openapispec
}
sourceSets {
main {
java.srcDir "$buildDir/generated/openapi/src/main/java"
}
testCommon {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/testCommon/java')
}
resources.srcDir file('src/testCommon/resources')
}
functionalTest {
java {
compileClasspath += main.output
compileClasspath += testCommon.output
runtimeClasspath += main.output
runtimeClasspath += testCommon.output
srcDir file('src/functionalTest/java')
}
resources.srcDir file('src/functionalTest/resources')
}
integrationTest {
java {
compileClasspath += main.output
compileClasspath += testCommon.output
runtimeClasspath += main.output
runtimeClasspath += testCommon.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
smokeTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/smokeTest/java')
}
resources.srcDir file('src/smokeTest/resources')
}
test {
java {
compileClasspath += main.output
compileClasspath += testCommon.output
runtimeClasspath += main.output
runtimeClasspath += testCommon.output
srcDir file('src/test/java')
}
resources.srcDir file('src/test/resources')
}
}
idea {
module {
testSources.from(sourceSets.integrationTest.allSource.srcDirs)
testResources.from(sourceSets.integrationTest.resources.srcDirs)
testSources.from(sourceSets.functionalTest.allSource.srcDirs)
testResources.from(sourceSets.functionalTest.resources.srcDirs)
testSources.from(sourceSets.smokeTest.allSource.srcDirs)
testResources.from(sourceSets.smokeTest.resources.srcDirs)
testSources.from(sourceSets.testCommon.allSource.srcDirs)
testResources.from(sourceSets.testCommon.resources.srcDirs)
}
}
configurations {
testCommonImplementation.extendsFrom testImplementation
functionalTestImplementation.extendsFrom testCommonImplementation
functionalTestRuntimeOnly.extendsFrom runtimeOnly
integrationTestImplementation.extendsFrom testCommonImplementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
smokeTestImplementation.extendsFrom testImplementation
smokeTestRuntimeOnly.extendsFrom runtimeOnly
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Werror"
}
// https://github.com/gradle/gradle/issues/16791
tasks.withType(JavaExec).configureEach {
javaLauncher.set(javaToolchains.launcherFor(java.toolchain))
}
tasks.withType(Test) {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
test {
failFast = false
}
task functional(type: Test) {
description = "Runs functional tests"
group = "Verification"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
exclude '**/performance/*'
classpath = sourceSets.functionalTest.runtimeClasspath
}
task functionalPerformance(type: Test) {
useJUnitPlatform()
description = "Runs functional tests"
group = "Verification"
testClassesDirs = sourceSets.functionalTest.output.classesDirs
include '**/performance/*'
classpath = sourceSets.functionalTest.runtimeClasspath
}
task integration(type: Test) {
description = "Runs integration tests"
group = "Verification"
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
failFast = false
}
task smoke(type: Test) {
description = "Runs Smoke Tests"
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}
checkstyle {
maxWarnings = 0
}
var sourceSetsCopy = sourceSets
pmd {
toolVersion = "7.11.0"
sourceSets = [sourceSetsCopy.main]
reportsDir = file("$project.buildDir/reports/pmd")
// https://github.com/pmd/pmd/issues/876
ruleSets = []
ruleSetFiles = files("config/pmd/main-ruleset.xml")
}
pmd {
toolVersion = "7.11.0"
sourceSets = [sourceSetsCopy.test, sourceSetsCopy.functionalTest, sourceSetsCopy.integrationTest, sourceSetsCopy.smokeTest]
reportsDir = file("$project.buildDir/reports/pmd")
// https://github.com/pmd/pmd/issues/876
ruleSets = []
ruleSetFiles = files("config/pmd/test-ruleset.xml")
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.required = true
csv.required = false
html.required = true
}
}
project.tasks['sonarqube'].dependsOn jacocoTestReport
project.tasks['check'].finalizedBy integration
def sonarExclusions = [
'**/com/emc/**',
'**/com/service/**',
'**/com/synapps/**',
'**/com/viqsoultions/**',
'**/uk/gov/courtservice/**',
'**/uk/gov/addcase/**',
'src/main/java/generated/**',
'**/uk/gov/hmcts/darts/**/model/**',
'**/uk/gov/hmcts/darts/**/config/**',
'**/enums/**',
'**/DocumentumIdToJwtCache*',
'**/CacheValueWithJwt*',
'**/com/service/viq/event/**',
'**/uk/gov/hmcts/darts/cache/token/service/**',
'**/uk/gov/hmcts/darts/test/**'
]
sonarqube {
properties {
property "sonar.projectName", "DARTS :: darts-gateway"
property "sonar.projectKey", "uk.gov.hmcts.reform:darts-gateway"
property "sonar.exclusions", sonarExclusions.join(', ')
}
}
// before committing a change, make sure task still works
dependencyUpdates {
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { qualifier -> version.toUpperCase().contains(qualifier) }
def regex = /^[0-9,.v-]+$/
return !stableKeyword && !(version ==~ regex)
}
rejectVersionIf { selection -> // <---- notice how the closure argument is named
return isNonStable(selection.candidate.version) && !isNonStable(selection.currentVersion)
}
}
// https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html
dependencyCheck {
// Specifies if the build should be failed if a CVSS score above a specified level is identified.
// range of 0-10 fails the build, anything greater and it doesn't fail the build
failBuildOnCVSS = 0
suppressionFile = 'config/owasp/suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
skipConfigurations = [
"compileOnly",
"pmd",
"integrationTest",
"functionalTest",
"smokeTest",
"contractTestRuntimeClasspath",
"contractTestCompileClasspath"
]
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext {
log4JVersion = "2.24.3"
wsdl4jVersion = "1.6.3"
}
ext['snakeyaml.version'] = '2.0'
task generateCodeFromSpecification() {
doFirst {
def openApiGenerateTaskList = []
//here we are going to store swagger files
def swaggerList = []
//iteration by swagger file root folder and save into swaggerList variable
def dir = new File(layout.buildDirectory.dir("extractedSpecs").get().asFile.absolutePath)
dir.eachFileRecurse(FILES) { file ->
if (file.getName().endsWith(".yaml") && !file.getName().contains("problem"))
swaggerList << file
}
// Iterate on all swagger files and generate a task for each one with the nomenclature openApiGenerate + swagger name
swaggerList.each {
def apiName = it.getName().replace(".yaml", "");
def apiLocation = it.getAbsolutePath();
def taskName = "openApiGenerate" + apiName.capitalize()
openApiGenerateTaskList << taskName
Task task = tasks.create(taskName, org.openapitools.generator.gradle.plugin.tasks.GenerateTask, {
generatorName = "spring"
inputSpec = "${apiLocation}"
outputDir = "$buildDir/generated/openapi".toString()
modelPackage = "uk.gov.hmcts.darts.model.".toString() + "${apiName}"
outputDir = "$buildDir/generated/openapi"
apiPackage = "uk.gov.hmcts.darts.api.${apiName}"
modelPackage = "uk.gov.hmcts.darts.model.${apiName}"
invokerPackage = "uk.gov.hmcts.darts.invoker.${apiName}"
library = "spring-cloud"
// https://openapi-generator.tech/docs/generators/java/#config-options
skipOperationExample = true
skipValidateSpec = true
configOptions = [
dateLibrary : "java8",
serializationLibrary: "jackson",
useJakartaEe : "true",
library : "spring-cloud",
interfaceOnly : "true"
]
})
task.actions.each { it.execute(task) }
}
}
}
sourceSets {
main {
java {
srcDir("$buildDir/generated/openapi/src/main/java")
}
}
}
dependencies {
implementation group: 'io.rest-assured', name: 'rest-assured'
implementation 'org.apache.tomcat.embed:tomcat-embed-core:10.1.36'
implementation 'org.apache.tomcat.embed:tomcat-embed-websocket:10.1.36'
implementation 'org.apache.tomcat.embed:tomcat-embed-el:10.1.36'
implementation 'org.apache.santuario:xmlsec:4.0.3'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-aop'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-json'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web-services'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-cache'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis'
implementation group: 'org.springframework.session', name: 'spring-session-data-redis'
implementation group: 'org.springframework', name: 'spring-context'
implementation 'org.springframework.integration:spring-integration-redis:6.4.2'
implementation group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '10.0.2'
implementation group: 'org.openapitools', name: 'jackson-databind-nullable', version: '0.2.6'
implementation group: 'org.springframework.ws', name: 'spring-ws-security', {
exclude group: 'com.google.guava', module: 'guava' // guava-30.1-jre.jar CVE-2023-2976, CVE-2020-8908
}
implementation group: 'com.google.guava', name: 'guava', version: '33.4.0-jre'
implementation group: 'org.bouncycastle', name: 'bcpkix-jdk18on', version: '1.80'
implementation group: 'org.bouncycastle', name: 'bcprov-jdk18on', version: '1.80'
implementation group: 'org.bouncycastle', name: 'bcutil-jdk18on', version: '1.80'
implementation group: 'wsdl4j', name: 'wsdl4j', version: wsdl4jVersion
jaxb('org.glassfish.jaxb:jaxb-xjc:4.0.5')
implementation('org.glassfish.jaxb:jaxb-runtime:4.0.5')
implementation group: 'org.apache.tika', name: 'tika-core', version: '3.1.0'
// https://mvnrepository.com/artifact/io.github.openfeign/feign-jackson
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.5'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '4.2.0', {
exclude group: 'commons-fileupload', module: 'commons-fileupload'
}
implementation group: 'commons-fileupload', name: 'commons-fileupload', version: '1.5'
implementation group: 'com.github.hmcts.java-logging', name: 'logging', version: '6.1.8'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: log4JVersion
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: log4JVersion
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.5.17'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.5.17'
implementation group: 'io.github.openfeign', name: 'feign-okhttp', version: '13.5'
constraints {
implementation('com.squareup.okio:okio:3.10.2') {
because 'version 3.0.0 has vulnerability CVE-2023-3635'
}
}
implementation 'org.zalando:problem-spring-web-starter:0.29.1'
implementation 'org.apache.commons:commons-collections4:4.4'
implementation 'org.mapstruct:mapstruct:1.6.3'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '5.3.0'
// https://mvnrepository.com/artifact/org.apache.ws.xmlschema/xmlschema-core
implementation group: 'org.apache.ws.xmlschema', name: 'xmlschema-core', version: '2.3.1'
// https://mvnrepository.com/artifact/javax.mail/javax.mail-api
implementation group: 'javax.mail', name: 'javax.mail-api', version: '1.6.2'
// https://mvnrepository.com/artifact/javax.activation/activation
implementation group: 'javax.activation', name: 'activation', version: '1.1.1'
// https://mvnrepository.com/artifact/com.sun.mail/javax.mail
implementation group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'
implementation project(path: ':context')
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation platform('com.azure:azure-sdk-bom:1.2.31')
implementation 'com.azure:azure-storage-blob'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
testImplementation(platform('org.junit:junit-bom:5.12.0'))
testImplementation group: 'org.springframework.boot', name: 'spring-boot-starter-test', {
exclude group: 'junit', module: 'junit'
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '5.2.0'
testImplementation group: 'org.springframework.ws', name: 'spring-ws-test', version: '4.0.11'
testImplementation group: 'commons-io', name: 'commons-io', version: '2.18.0'// CVE-2021-29425
testImplementation group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'org.xmlunit:xmlunit-matchers:2.10.0'
testImplementation 'org.testcontainers:testcontainers:1.20.6'
testImplementation 'org.springframework.boot:spring-boot-testcontainers'
testImplementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-contract-stub-runner', version: '4.2.0'
testImplementation group: 'org.testcontainers', name: 'junit-jupiter', version: '1.20.6'
testImplementation 'it.ozimov:embedded-redis:0.7.3'
testImplementation 'io.github.hakky54:logcaptor:2.10.1'
testImplementation group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.6.3', {
exclude group: 'org.codehaus.groovy', module: 'groovy-json'
exclude group: 'org.codehaus.groovy', module: 'groovy-xml'
exclude group: 'org.codehaus.groovy', module: 'groovy-jso'
exclude group: 'org.codehaus.groovy', module: 'groovy'
}
testImplementation group: 'org.apache.jmeter', name: 'ApacheJMeter_http', version: '5.6.3'
openapispec 'com.github.hmcts:darts-api:master-SNAPSHOT:openapi'
}
mainClassName = 'uk.gov.hmcts.darts.Application'
bootJar {
archiveFileName = "darts-gateway.jar"
manifest {
attributes('Implementation-Version': project.version.toString())
}
}
// Gradle 7.x issue, workaround from: https://github.com/gradle/gradle/issues/17236#issuecomment-894768083
rootProject.tasks.named("processSmokeTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processIntegrationTestResources") {
duplicatesStrategy = 'include'
}
rootProject.tasks.named("processFunctionalTestResources") {
duplicatesStrategy = 'include'
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
tasks.withType(Checkstyle) {
exclude 'com/service/mojdarts/synapps/com/**'
exclude 'com/synapps/moj/dfs/response/*.java'
exclude 'com/emc/**/*.java'
exclude 'uk/gov/courtservice/**/*.java'
exclude 'uk/gov/addcase/**/*.java'
exclude 'com/viqsoultions/**/*.java'
exclude 'com/service/viq/event/**/*.java'
}
tasks.withType(Pmd) {
exclude 'com/service/mojdarts/synapps/com/**'
exclude 'com/synapps/moj/dfs/response/**'
exclude 'com/emc/**/*.java'
exclude 'uk/gov/courtservice/**/*.java'
exclude 'uk/gov/addcase/**/*.java'
exclude 'com/viqsoultions/**/*.java'
exclude 'com/service/viq/event/**/*.java'
}
sourceSets {
main {
java {
srcDir 'src/main/java'
srcDir 'src/main/java/generated'
srcDir 'build/generated-sources/jaxb'
srcDir 'build/generated-sources/jaxbViqEvent'
srcDir 'build/generated-sources/jaxbRegisterNode'
srcDir 'build/generated-sources/jaxbAddCase'
srcDir 'build/generated-sources/jaxbAddAudio'
srcDir 'build/generated-sources/jaxbViqEvent'
}
}
}
tasks.named('processTestResources', Copy) {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
task genJaxb {
ext.sourcesDir = "${buildDir}/generated-sources/jaxb"
ext.schema = "src/main/resources/schemas/dar-notify-event.xsd"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
xjc(destdir: sourcesDir, schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
}
}
}
task genJaxbViqEvent {
ext.sourcesDir = "${buildDir}/generated-sources/jaxbViqEvent"
ext.schema = "src/main/resources/schemas/event.xsd"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
xjc(destdir: sourcesDir, package: "com.service.viq.event", schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
}
}
}
task genJaxbRegisterNode {
ext.sourcesDir = "${buildDir}/generated-sources/jaxbRegisterNode"
ext.schema = "src/main/resources/schemas/darts-register-node.xsd"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
xjc(destdir: sourcesDir, package: "com.service.mojdarts.synapps.com.registernode", schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
}
}
}
task genJaxbAddCase {
ext.sourcesDir = "${buildDir}/generated-sources/jaxbAddCase"
ext.schema = "src/main/resources/schemas/darts-add-case.xsd"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
xjc(destdir: sourcesDir, package: "com.service.mojdarts.synapps.com.addcase", schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
}
}
}
task genJaxbAddAudio {
ext.sourcesDir = "${buildDir}/generated-sources/jaxbAddAudio"
ext.schema = "src/main/resources/schemas/addAudio.xsd"
outputs.dir sourcesDir
doLast() {
project.ant {
taskdef name: "xjc", classname: "com.sun.tools.xjc.XJCTask", classpath: configurations.jaxb.asPath
mkdir(dir: sourcesDir)
xjc(destdir: sourcesDir, package: "com.service.mojdarts.synapps.com.addaudio", schema: schema) {
arg(value: "-wsdl")
produces(dir: sourcesDir, includes: "**/*.java")
}
}
}
}
wsdl2java {
wsdlDir.set(layout.projectDirectory.dir("src/main/resources/ws/dartsService"))
includes = [
"**/*.wsdl"
]
}
compileJava.dependsOn genJaxb
task extractOpenSpecification() {
doFirst {
configurations.openapispec.getFiles()
.each {
def zip = new java.util.zip.ZipFile(it)
for (def entry : zip.entries()) {
if (entry == null) return
String contents = zip.getInputStream(entry).text
String name = entry.name
if (name.endsWith(".yaml")) {
// Finally, we write the contents to a file
new File(layout.buildDirectory.dir("extractedSpecs").get().asFile.absolutePath).mkdirs()
String newFileName = "${layout.buildDirectory.dir("extractedSpecs").get().asFile.absolutePath}/$name"
def newFile = new File(newFileName)
newFile.createNewFile()
newFile.text = contents
}
}
}
}
}
/**
* Run the custom task with the defaults to process the legacy darts service
*/
tasks.register('processDartsServiceWSDL', CreateAPIMWSDLFile)
{
wsdlFile = new File("src/main/resources/ws/dartsService/DARTSService.wsdl")
urlToReplace = "http://test"
outputFile = new File("src/main/resources/ws/dartsService.wsdl")
}
project.tasks.processResources.dependsOn processDartsServiceWSDL
project.tasks.wsdl2java.dependsOn processDartsServiceWSDL
compileJava.dependsOn generateCodeFromSpecification
generateCodeFromSpecification.dependsOn extractOpenSpecification
compileJava.dependsOn genJaxbAddCase, genJaxbRegisterNode, genJaxbAddAudio, genJaxbViqEvent
tasks.named { it == "generateEffectiveLombokConfig" }.configureEach {
dependsOn(genJaxb)
dependsOn(genJaxbAddAudio)
dependsOn(genJaxbAddCase)
dependsOn(genJaxbRegisterNode)
dependsOn(genJaxbViqEvent)
}
task runAllStyleChecks {
dependsOn 'checkstyleMain'
dependsOn 'checkstyleTest'
dependsOn 'checkstyleIntegrationTest'
dependsOn 'checkstyleSmokeTest'
dependsOn 'checkstyleFunctionalTest'
dependsOn 'checkstyleTestCommon'
dependsOn 'pmdMain'
dependsOn 'pmdTest'
dependsOn 'pmdIntegrationTest'
dependsOn 'pmdSmokeTest'
dependsOn 'pmdFunctionalTest'
dependsOn 'pmdTestCommon'
}