forked from hmcts/ccd-data-store-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
673 lines (566 loc) · 25.8 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
buildscript {
ext {
springBootVersion = '2.1.4.RELEASE'
}
dependencies {
classpath 'org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:0.5.1'
}
dependencies {
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.2'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'application'
id 'com.github.ben-manes.versions' version '0.20.0'
id 'org.sonarqube' version '2.6.2'
id 'jacoco'
id 'checkstyle'
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'se.patrikerdes.use-latest-versions' version '0.2.7'
id 'org.owasp.dependencycheck' version '3.3.2'
id 'com.github.spotbugs' version '1.6.9'
id 'net.ltgt.apt' version '0.21'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'net.ltgt.apt-idea'
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'org.sonarqube'
apply plugin: 'jsonschema2pojo'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'se.patrikerdes.use-latest-versions'
apply plugin: 'org.owasp.dependencycheck'
apply from: 'liquibase.gradle'
pmd {
toolVersion = '6.11.0'
}
dependencyUpdates.resolutionStrategy = {
componentSelection { rules ->
rules.all { ComponentSelection selection ->
boolean rejected = ['alpha', 'beta', 'rc', 'cr', 'm'].any { qualifier ->
selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
}
if (rejected) {
selection.reject('Release candidate')
}
}
}
}
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
// Wiremock requires old jetty because it still support java 7
// spring bom is currenty upgrading it
if (details.requested.group == 'org.eclipse.jetty') {
details.useVersion '9.2.24.v20180105'
}
}
}
}
// 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 = System.getProperty('dependencyCheck.failBuild') == 'false' ? 11 : 0
suppressionFile = 'dependency-check-suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
mainClassName = 'uk.gov.hmcts.ccd.CoreCaseDataApplication'
// tag::repositories[]
repositories {
mavenLocal()
mavenCentral()
jcenter()
maven {
url 'https://dl.bintray.com/hmcts/hmcts-maven'
}
}
// end::repositories[]
ext {
junitJupiterVersion = '5.2.0'
junitVintageVersion = '5.2.0'
hibernateVersion = '5.2.17.Final'
powermockVersion = '2.0.0-beta.5'
reformLogging = '5.0.1'
swagger2Version = '2.9.2'
limits = [
'instruction': 90,
'branch' : 85,
'line' : 90,
'complexity' : 88,
'method' : 90,
'class' : 98
]
appInsights = '2.0.1'
springCloudVersion = 'Greenwich.RELEASE'
}
group 'uk.gov.hmcts.ccd'
version '1.2.0-SNAPSHOT'
bootJar {
baseName = 'core-case-data'
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': project.version
}
archiveName = 'core-case-data.jar'
}
// tag::dependencies[]
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations {
providedRuntime
annotationProcessor
// runtime.exclude group: 'com.microsoft.azure', module: 'applicationinsights-agent'
aatCompile.extendsFrom(testCompile)
aatRuntime.extendsFrom(testRuntime)
}
checkstyle {
maxWarnings = 2934 // In the Ideal world this should be 0
toolVersion = '8.18'
}
checkstyleMain.shouldRunAfter(compileJava)
test.shouldRunAfter(checkstyleTest)
tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
spotbugs {
ignoreFailures = true
}
dependencies {
compile group: 'uk.gov.hmcts.reform', name: 'java-logging', version: reformLogging
compile group: 'uk.gov.hmcts.reform', name: 'java-logging-appinsights', version: reformLogging
compile 'uk.gov.hmcts.reform:properties-volume-spring-boot-starter:0.0.4'
compile 'uk.gov.hmcts.reform:health-spring-boot-starter:0.0.3'
compile 'org.projectlombok:lombok:1.18.4'
implementation 'org.mapstruct:mapstruct-jdk8:1.3.0.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.2.0.Final', 'org.projectlombok:lombok:1.18.4'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.2.0.Final', 'org.projectlombok:lombok:1.18.4'
// Needs to explicitly bring in a different hibernate version as in pom.xml
compile "org.hibernate:hibernate-core:${hibernateVersion}"
compile "org.hibernate:hibernate-entitymanager:${hibernateVersion}"
compile('org.springframework.boot:spring-boot-starter-actuator')
compile("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: 'org.hibernate', module: 'hibernate-core'
exclude group: 'org.hibernate', module: 'hibernate-entitymanager'
}
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile(group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc') {
exclude group: 'org.apache.tomcat', module: 'tomcat-jdbc'
}
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.cloud:spring-cloud-starter-openfeign')
compile('org.springframework.retry:spring-retry')
compile('org.springframework.boot:spring-boot-starter-cache')
compile group: 'com.hazelcast', name: 'hazelcast'
compile group: 'com.hazelcast', name: 'hazelcast-spring'
compile group: 'javax.inject', name: 'javax.inject', version: '1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.1'
compile group: 'io.springfox', name: 'springfox-swagger2', version: swagger2Version
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: swagger2Version
compile group: 'org.liquibase', name: 'liquibase-core', version: '3.6.3'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.9.5'
compile (group: 'uk.gov.hmcts.reform.auth', name: 'auth-checker-lib', version: '2.1.3') {
// TODO remove when auth-checker-lib upgrades its dependency to spring boot 2.0.x
exclude group: 'uk.gov.hmcts.reform', module: 'java-logging-spring'
}
compile group: 'uk.gov.hmcts.reform', name: 'service-auth-provider-client', version: '2.0.0'
compile group: 'com.sun.mail', name: 'mailapi', version: '1.6.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'commons-validator', name: 'commons-validator', version: '1.6'
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.4.0'
// CVE-2019-12086 - force update of jackson-databind - remove when dependencies move off <2.9.9
compile "com.fasterxml.jackson.core:jackson-databind:2.9.9"
// FIXME 0.6 doesn't support jsonb; 0.7 doesn't work on Windows
// runtime group: 'com.impossibl.pgjdbc-ng', name: 'pgjdbc-ng', version: '0.6'
runtime group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
runtime group: 'com.zaxxer', name: 'HikariCP', version: '2.7.9'
testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation('org.springframework.cloud:spring-cloud-starter-contract-stub-runner')
testCompile ('com.opentable.components:otj-pg-embedded:0.12.0')
testCompile ('com.github.tomakehurst:wiremock-jre8:2.21.0')
testCompile ('org.springframework.cloud:spring-cloud-contract-wiremock:2.1.0.RELEASE')
// To avoid compiler warnings about @API annotations in JUnit5 code.
testCompileOnly 'org.apiguardian:apiguardian-api:1.0.0'
testCompile "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
testRuntime "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
testRuntime "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}"
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.24.0'
testCompile group:'org.mockito', name: 'mockito-junit-jupiter', version:'2.24.0'
testCompile group: 'org.powermock', name: 'powermock-api-mockito2', version: powermockVersion
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
testCompile group: 'io.rest-assured', name: 'rest-assured', version: '3.1.0'
testCompile group: 'com.xebialabs.restito', name: 'restito', version: '0.9.3'
testCompile 'io.github.openfeign:feign-jackson:9.7.0'
// for sonar analysis
testCompile group: 'org.openid4java', name: 'openid4java', version: '1.0.0'
// remove me once insights is in
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
//excluding log4j-core which causes a vulnerability issue
compile(group: 'io.searchbox', name: 'jest', version: '6.3.1') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-core'
}
compile(group: 'org.elasticsearch', name: 'elasticsearch', version: '6.4.2') {
exclude group: 'org.apache.logging.log4j', module: 'log4j-api'
}
compile 'org.jooq:jool-java-8:0.9.14'
}
// end::dependencies[]
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
dependencies {
// CVE-2019-0232 - Java and Command Line injections in Windows
dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.19') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-el'
entry 'tomcat-embed-websocket'
}
}
}
task projectVersion {
description 'Prints the version of this project; used for publishing JAR file'
doLast {
print project.version
}
}
idea {
project {
// experimental: whether annotation processing will be configured in the IDE; only actually used with the 'idea' task.
configureAnnotationProcessing = true
}
module {
apt {
// whether generated sources dirs are added as generated sources root
addGeneratedSourcesDirs = true
// whether the annotationProcessor/apt and testAnnotationProcessor/testApt dependencies are added as module dependencies
addAptDependencies = true
// the dependency scope used for apt and/or compileOnly dependencies (when enabled above)
mainDependenciesScope = "PROVIDED" // defaults to "COMPILE" when using the Gradle integration in IntelliJ IDEA
}
}
}
// copied from https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin
// Note A problem was found with the configuration of task ':generateJsonSchema2Pojo'.
// Registering invalid inputs and outputs via TaskInputs and TaskOutputs methods has been deprecated
// and is scheduled to be removed in Gradle 5.0.
jsonSchema2Pojo {
// Whether to allow 'additional' properties to be supported in classes by adding a map to
// hold these. This is true by default, meaning that the schema rule 'additionalProperties'
// controls whether the map is added. Set this to false to globabally disable additional properties.
includeAdditionalProperties = true
// Whether to generate builder-style methods of the form withXxx(value) (that return this),
// alongside the standard, void-return setters.
generateBuilders = false
// Whether to use primitives (long, double, boolean) instead of wrapper types where possible
// when generating bean properties (has the side-effect of making those properties non-null).
usePrimitives = false
// Location of the JSON Schema file(s). This may refer to a single file or a directory of files.
source = files("${sourceSets.main.output.resourcesDir}/schema")
// Target directory for generated Java source files. The plugin will add this directory to the
// java source set so the compiler will find and compile the newly generated source files.
targetDirectory = file("${project.buildDir}/generated-sources/js2p")
// Package name used for generated Java classes (for types where a fully qualified name has not
// been supplied in the schema using the 'javaType' property).
targetPackage = 'uk.gov.hmcts.ccd.domain.types.sanitiser.document'
// The characters that should be considered as word delimiters when creating Java Bean property
// names from JSON property names. If blank or not set, JSON properties will be considered to
// contain a single word when creating Java Bean property names.
propertyWordDelimiters = [] as char[]
// Whether to use the java type long (or Long) instead of int (or Integer) when representing the
// JSON Schema type 'integer'.
useLongIntegers = false
// Whether to use the java type BigInteger when representing the JSON Schema type 'integer'. Note
// that this configuration overrides useLongIntegers
useBigIntegers = false
// Whether to use the java type double (or Double) instead of float (or Float) when representing
// the JSON Schema type 'number'.
useDoubleNumbers = true
// Whether to use the java type BigDecimal when representing the JSON Schema type 'number'. Note
// that this configuration overrides useDoubleNumbers
useBigDecimals = false
// Whether to include hashCode and equals methods in generated Java types.
includeHashcodeAndEquals = true
// Whether to include a toString method in generated Java types.
includeToString = true
// The style of annotations to use in the generated Java types. Supported values:
// - jackson (alias of jackson2)
// - jackson2 (apply annotations from the Jackson 2.x library)
// - jackson1 (apply annotations from the Jackson 1.x library)
// - gson (apply annotations from the Gson library)
// - moshi1 (apply annotations from the Moshi 1.x library)
// - none (apply no annotations at all)
annotationStyle = 'jackson'
// A fully qualified class name, referring to a custom annotator class that implements
// org.jsonschema2pojo.Annotator and will be used in addition to the one chosen
// by annotationStyle. If you want to use the custom annotator alone, set annotationStyle to none.
customAnnotator = 'org.jsonschema2pojo.NoopAnnotator'
// Whether to include JSR-303/349 annotations (for schema rules like minimum, maximum, etc) in
// generated Java types. Schema rules and the annotation they produce:
// - maximum = @DecimalMax
// - minimum = @DecimalMin
// - minItems,maxItems = @Size
// - minLength,maxLength = @Size
// - pattern = @Pattern
// - required = @NotNull
// Any Java fields which are an object or array of objects will be annotated with @Valid to
// support validation of an entire document tree.
includeJsr303Annotations = false
// The type of input documents that will be read. Supported values:
// - jsonschema (schema documents, containing formal rules that describe the structure of JSON data)
// - json (documents that represent an example of the kind of JSON data that the generated Java types
// will be mapped to)
// - yamlschema (JSON schema documents, represented as YAML)
// - yaml (documents that represent an example of the kind of YAML (or JSON) data that the generated Java types
// will be mapped to)
sourceType = 'jsonschema'
// Whether to empty the target directory before generation occurs, to clear out all source files
// that have been generated previously. <strong>Be warned</strong>, when activated this option
// will cause jsonschema2pojo to <strong>indiscriminately delete the entire contents of the target
// directory (all files and folders)</strong> before it begins generating sources.
removeOldOutput = false
// The character encoding that should be used when writing the generated Java source files
outputEncoding = 'UTF-8'
// Whether to use {@link org.joda.time.DateTime} instead of {@link java.util.Date} when adding
// date type fields to generated Java types.
useJodaDates = false
// Whether to add JsonFormat annotations when using Jackson 2 that cause format "date", "time", and "date-time"
// fields to be formatted as yyyy-MM-dd, HH:mm:ss.SSS and yyyy-MM-dd'T'HH:mm:ss.SSSZ respectively. To customize these
// patterns, use customDatePattern, customTimePattern, and customDateTimePattern config options or add these inside a
// schema to affect an individual field
formatDateTimes = true
formatDates = true
formatTimes = true
// Whether to use commons-lang 3.x imports instead of commons-lang 2.x imports when adding equals,
// hashCode and toString methods.
useCommonsLang3 = false
// Whether to initialize Set and List fields as empty collections, or leave them as null.
initializeCollections = true
// Whether to add a prefix to generated classes.
classNamePrefix = ""
// Whether to add a suffix to generated classes.
classNameSuffix = ""
// An array of strings that should be considered as file extensions and therefore not included in class names.
fileExtensions = [] as String[]
// Whether to generate constructors or not.
includeConstructors = false
// **EXPERIMENTAL** Whether to make the generated types Parcelable for Android
parcelable = false
// Whether to make the generated types Serializable
serializable = false
// Whether to include getters/setters or to omit these accessor methods and create public fields instead.
includeAccessors = true
// Whether to include getters or to omit these accessor methods and create public fields instead.
includeGetters = false
// Whether to include setters or to omit these accessor methods and create public fields instead.
includeSetters = false
// Whether to include dynamic getters, setters, and builders or to omit these methods.
includeDynamicAccessors = false
// Whether to include dynamic getters or to omit these methods.
includeDynamicGetters = false
// Whether to include dynamic setters or to omit these methods.
includeDynamicSetters = false
// Whether to include dynamic builders or to omit these methods.
includeDynamicBuilders = false
// What type to use instead of string when adding string properties of format "date" to Java types
dateType = "java.time.LocalDate"
// What type to use instead of string when adding string properties of format "date-time" to Java types
dateTimeType = "java.time.LocalDateTime"
}
jacoco {
toolVersion = "0.8.0"
}
sonarqube {
properties {
property "sonar.exclusions", "build/generated-sources/**/*.java"
property "sonar.coverage.exclusions", "src/main/java/uk/gov/hmcts/ccd/data/definition/DefaultCaseDefinitionRepository.java,src/main/java/uk/gov/hmcts/ccd/AppInsights.java"
property "sonar.jacoco.reportPaths", "${project.buildDir}/jacoco/junitPlatformTest.exec"
property "sonar.junit.reportPaths", "${project.buildDir}/test-results/junit-platform"
property "sonar.projectName", "ccd-data-store-api"
property "sonar.projectKey", "ccd-data-store-api"
}
}
compileJava {
options.annotationProcessorPath = configurations.annotationProcessor
}
compileTestJava {
options.annotationProcessorPath = configurations.annotationProcessor
}
// adopted from
// https://github.com/springfox/springfox/blob/fb780ee1f14627b239fba95730a69900b9b2313a/gradle/coverage.gradle
jacocoTestReport {
doFirst {
logger.lifecycle("{} Starting jacocoTestReport ...", timestamp())
}
reports {
// XML required by coveralls and for the below coverage checks
// and html are generated by default
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['uk/gov/hmcts/ccd/domain/types/sanitiser/document/**'])
})
}
doLast {
def report = file("${jacoco.reportsDir}/test/jacocoTestReport.xml")
logger.lifecycle("Checking coverage results: ${report}")
def parser = new XmlParser()
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
def results = parser.parse(report)
def percentage = {
def covered = it.'@covered' as Double
def missed = it.'@missed' as Double
((covered / (covered + missed)) * 100).round(2)
}
def counters = results.counter
def metrics = [:]
metrics << [
'instruction': percentage(counters.find { it.'@type'.equals('INSTRUCTION') }),
'branch' : percentage(counters.find { it.'@type'.equals('BRANCH') }),
'line' : percentage(counters.find { it.'@type'.equals('LINE') }),
'complexity' : percentage(counters.find { it.'@type'.equals('COMPLEXITY') }),
'method' : percentage(counters.find { it.'@type'.equals('METHOD') }),
'class' : percentage(counters.find { it.'@type'.equals('CLASS') })
]
def failures = []
metrics.each {
def limit = limits[it.key]
if (it.value < limit) {
failures.add("- ${it.key} coverage rate is: ${it.value}%, minimum is ${limit}%")
}
}
if (failures) {
logger.quiet("------------------ Code Coverage Failed -----------------------")
failures.each {
logger.quiet(it)
}
logger.quiet("---------------------------------------------------------------")
throw new GradleException("Code coverage failed")
} else {
logger.quiet("Passed Code Coverage Checks")
}
}
}
test {
environment("AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY", "some-key")
useJUnitPlatform()
testLogging {
// set options for log level LIFECYCLE
events "failed"
exceptionFormat "short"
// set options for log level DEBUG
debug {
events "passed", "started", "skipped", "failed"
exceptionFormat "full"
}
// remove standard output/error logging from --info builds
// by assigning only 'failed' and 'skipped' events
info.events = ["failed", "skipped"]
}
reports {
html.enabled = true
}
}
check.dependsOn jacocoTestReport
sourceSets {
aat {
java {
srcDir('src/aat/java')
compileClasspath += main.output
runtimeClasspath += main.output
}
resources {
srcDir('src/aat/resources')
}
}
}
task smoke(type: Test) {
systemProperty "http.proxyHost", System.getProperty('http.proxyHost')
systemProperty "http.proxyPort", System.getProperty('http.proxyPort')
systemProperty "https.proxyHost", System.getProperty('https.proxyHost')
systemProperty "https.proxyPort", System.getProperty('https.proxyPort')
environment("AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY", "some-key")
group = 'Delivery pipeline'
description = 'Executes smoke tests against an AAT CCD Data Store instance'
setTestClassesDirs(sourceSets.aat.output.classesDirs)
setClasspath(sourceSets.aat.runtimeClasspath)
include "uk/gov/hmcts/ccd/datastore/tests/functional/**"
include "uk/gov/hmcts/ccd/datastore/tests/v2/**"
useJUnitPlatform {
includeTags 'smoke'
}
}
task functional(type: Test) {
systemProperty "http.proxyHost", System.getProperty('http.proxyHost')
systemProperty "http.proxyPort", System.getProperty('http.proxyPort')
systemProperty "https.proxyHost", System.getProperty('https.proxyHost')
systemProperty "https.proxyPort", System.getProperty('https.proxyPort')
environment("AZURE_APPLICATIONINSIGHTS_INSTRUMENTATIONKEY", "some-key")
group = 'Delivery pipeline'
description = 'Executes functional tests against an AAT CCD Data Store instance'
setTestClassesDirs(sourceSets.aat.output.classesDirs)
setClasspath(sourceSets.aat.runtimeClasspath)
include "uk/gov/hmcts/ccd/datastore/tests/functional/**"
include "uk/gov/hmcts/ccd/datastore/tests/v2/**"
useJUnitPlatform()
}
def timestamp() {
def date = new Date()
return date.format('yyyy-MM-dd HH:mm:ss')
}
//distributions {
// main {
// contents {
// from(file("$projectDir/src/main/resources/AI-Agent.xml")) {
// into "lib"
// }
// }
// }
//}
// for cnp pipeline
task dependencyCheck(dependsOn: dependencyCheckAnalyze)
configurations { codacy }
repositories {
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/typesafe/maven-releases" }
}
dependencies {
codacy 'com.github.codacy:codacy-coverage-reporter:-SNAPSHOT'
}
task sendCoverageToCodacy(type: JavaExec, dependsOn: jacocoTestReport) {
main = "com.codacy.CodacyCoverageReporter"
classpath = configurations.codacy
args = [
"report",
"-l",
"Java",
"-r",
"${buildDir}/reports/jacoco/test/jacocoTestReport.xml"
]
}
task installDist(overwrite: true) {
// This task must be overwritten to do as it's breaking JAR packaging and it's a mandatory step of swagger
// documentation publication.
}