forked from hmcts/data-extractor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
203 lines (166 loc) · 5.96 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
plugins {
id 'application'
id 'java'
id 'checkstyle'
id 'jacoco'
id 'pmd'
id 'org.owasp.dependencycheck' version '5.1.0'
id 'com.github.ben-manes.versions' version '0.17.0'
id 'org.sonarqube' version '2.7'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id "net.java.openjdk.shinyafox.jshell.gradle.plugin" version "1.0.4"
}
group 'uk.gov.hmcts.reform'
version '1.0.0'
archivesBaseName = 'data-extractor'
mainClassName = 'uk.gov.hmcts.reform.dataextractor.DataExtractorApplication'
sourceCompatibility = 11
targetCompatibility = 11
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integrationTest/java')
}
resources.srcDir file('src/integrationTest/resources')
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
task integration(type: Test, description: 'Runs the integration tests.', group: 'Verification') {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
useJUnitPlatform()
mustRunAfter test
testLogging {
exceptionFormat = 'full'
}
}
check {
dependsOn integration
}
checkstyle {
maxWarnings = 0
toolVersion = '8.18'
// need to set configDir to rootDir otherwise submodule will use submodule/config/checkstyle
configDir = new File(rootDir, 'config/checkstyle')
}
pmd {
toolVersion = "6.11.0"
sourceSets = [sourceSets.main, sourceSets.test, sourceSets.integrationTest]
reportsDir = file("$project.buildDir/reports/pmd")
ruleSetFiles = files("config/pmd/ruleset.xml")
}
jacoco {
toolVersion = "0.8.3"
}
jacocoTestReport {
executionData(test, integration)
reports {
xml.enabled = true
csv.enabled = false
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
}
}
project.tasks['sonarqube'].dependsOn test, integration
sonarqube {
properties {
property "sonar.projectName", "data-extractor-job"
property "sonar.projectKey", "data-extractor-job"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/test/jacocoTestReport.xml"
property 'sonar.coverage.exclusions', "**/uk/gov/hmcts/reform/dataextractor/Extractor*.java,**/uk/gov/hmcts/reform/dataextractor/Query*.java,**/uk/gov/hmcts/reform/dataextractor/BlobOut*.java"
}
}
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')
}
}
}
}
// 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') == 'true' ? 0 : 11
suppressionFile = 'config/owasp/suppressions.xml'
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
repositories {
mavenLocal()
maven {
url "https://dl.bintray.com/hmcts/hmcts-maven"
}
jcenter()
mavenCentral()
}
jar {
manifest {
attributes 'Main-Class': 'uk.gov.hmcts.reform.dataextractor.DataExtractorApplication',
'Implementation-Title': project.name,
'Implementation-Version': project.version
}
}
shadowJar {
baseName = 'data-extractor'
classifier = null
version = '1.0.0'
}
def versions = [
junit: '5.4.2',
logging: '5.0.1',
jackson: '2.9.9'
]
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group in ['com.fasterxml.jackson.core', 'com.fasterxml.jackson.module', 'com.fasterxml.jackson.datatype']) {
details.useVersion '2.9.9'
}
}
}
}
dependencies {
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
compile group: 'com.microsoft.azure', name: 'azure-storage', version: '8.3.0'
compile group: 'com.microsoft.azure.msi_auth_token_provider', name: 'azure-authentication-msi-token-provider', version: '1.0.0-Beta-1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: versions.jackson
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.6'
compile group: 'com.google.guava', name: 'guava', version: '28.0-jre'
compile group: 'com.typesafe', name: 'config', version: '1.3.4'
compile group: 'uk.gov.hmcts.reform', name: 'java-logging', version: versions.logging
compile group: 'uk.gov.hmcts.reform', name: 'java-logging-appinsights', version: versions.logging
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.26'
// needed for app insights
compile group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: versions.junit
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: versions.junit
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: versions.junit
testRuntimeOnly group: 'org.junit.vintage', name: 'junit-vintage-engine', version: versions.junit
testCompile group: 'org.mockito', name: 'mockito-junit-jupiter', version: '2.25.0'
integrationTestCompile 'org.testcontainers:postgresql:1.11.2'
integrationTestCompile 'org.testcontainers:junit-jupiter:1.11.2'
integrationTestCompile 'com.ninja-squad:DbSetup:2.1.0'
integrationTestCompile sourceSets.main.runtimeClasspath
integrationTestCompile sourceSets.test.runtimeClasspath
}
mainClassName = 'uk.gov.hmcts.reform.dataextractor.DataExtractorApplication'
wrapper {
distributionType = Wrapper.DistributionType.ALL
}