-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
131 lines (112 loc) · 3.77 KB
/
build.gradle
File metadata and controls
131 lines (112 loc) · 3.77 KB
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
plugins {
id 'org.owasp.dependencycheck' version '12.1.3'
id 'com.github.ben-manes.versions' version '0.52.0'
}
def buildNumber = System.getenv("RELEASE_VERSION")?: "DEV-SNAPSHOT"
allprojects {
group 'com.github.hmcts.java-logging'
version buildNumber
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'pmd'
checkstyle {
toolVersion = '13.4.0'
maxWarnings = 0
getConfigDirectory().set(new File(rootDir, "config/checkstyle"))
}
pmd {
toolVersion = "7.19.0"
ignoreFailures = true
incrementalAnalysis = true
sourceSets = [sourceSets.main, sourceSets.test]
reportsDir = file("$rootProject.buildDir/reports/pmd/$project.name")
ruleSetFiles = files("$rootProject.projectDir/config/pmd/ruleset.xml")
}
jacoco {
toolVersion = "0.8.13"
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
}
// 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)
}
}
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 = "$rootDir/config/owasp/suppressions.xml"
analyzers {
// Disable scanning of .NET related binaries
assemblyEnabled = false
}
}
}
task codeCoverageReport(type: JacocoReport, dependsOn: allprojects*.test) {
// Gather execution data from all subprojects
// (change this if you e.g. want to calculate unit test/integration test coverage separately)
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
// Add all relevant sourcesets from the subprojects
allprojects.each {
sourceSets it.sourceSets.main
}
reports {
csv.required = false
html.required = true
html.destination = file("${buildDir}/reports/jacoco/html")
xml.required = true
xml.destination = file("${buildDir}/reports/jacoco/jacocoTestReport.xml")
}
}
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
Main(MavenPublication) {
from components.java
groupId project.group
artifactId 'logging'
version project.version
}
}
repositories {
maven {
name = "AzureArtifacts"
url = uri("https://pkgs.dev.azure.com/hmcts/Artifacts/_packaging/hmcts-lib/maven/v1")
credentials {
username = System.getenv("AZURE_DEVOPS_ARTIFACT_USERNAME")
password = System.getenv("AZURE_DEVOPS_ARTIFACT_TOKEN")
}
}
}
}
dependencies {
testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.19.0'
testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.27.4'
testImplementation group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0'
testImplementation group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'
testImplementation group: 'com.google.code.tempus-fugit', name: 'tempus-fugit', version: '1.1'
}