-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
159 lines (141 loc) · 4.64 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
import com.github.spotbugs.snom.SpotBugsTask
import org.springframework.boot.gradle.plugin.SpringBootPlugin
plugins {
id 'java-library'
id 'maven-publish'
id 'org.springframework.boot' version '2.7.5' apply false
id 'com.github.spotbugs' version '5.0.13'
id 'com.diffplug.spotless' version '6.11.0'
id 'com.github.nbaztec.coveralls-jacoco' version '1.2.15'
id 'org.owasp.dependencycheck' version '7.4.1'
id 'com.github.jk1.dependency-license-report' version '2.1'
}
allprojects {
group = 'dev.vox.platform.kahpp'
version = 'SNAPSHOT'
if (project.hasProperty('projVersion')) {
project.version = project.projVersion
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
}
}
def rootBuildDir = project.buildDir.path
def root = project.rootDir.path
subprojects {
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.github.spotbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'com.github.nbaztec.coveralls-jacoco'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'signing'
dependencyManagement {
imports {
mavenBom SpringBootPlugin.BOM_COORDINATES
mavenBom 'com.fasterxml.jackson:jackson-bom:2.14.2'
}
}
dependencies {
compileOnly("com.github.spotbugs:spotbugs-annotations:4.7.3")
testCompileOnly("com.github.spotbugs:spotbugs-annotations:4.7.2")
pmd("net.sourceforge.pmd:pmd-java:6.51.0") {
exclude group: 'commons-io', module: 'commons-io'
}
pmd("commons-io:commons-io:2.11.0")
}
test {
useJUnitPlatform()
}
pmd {
ignoreFailures = false
consoleOutput = true
incrementalAnalysis = true
setRuleSetFiles(layout.files("$root/config/pmd-ruleset.xml"))
ruleSets = []
}
spotbugs {
excludeFilter = file("$root/config/spotbugs-exclude.xml")
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
auxClassPaths = sourceSets.getByName("main").compileClasspath + sourceSets.getByName("test").compileClasspath
}
jacoco {
toolVersion = "0.8.7"
jacocoTestReport {
dependsOn test
reports {
xml.enabled true
xml.destination file("$rootBuildDir/reports/jacoco/test/jacocoTestReport.xml")
html.destination file("${rootBuildDir}/jacocoHtml")
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 0.92
}
excludes = [
// No need to test the main method...
'dev.vox.platform.kahpp.Application',
// No need to test these internal classes
'dev.vox.platform.kahpp.configuration.TransformRecord.JmesPathMutation',
'dev.vox.platform.kahpp.configuration.TransformRecord.RemoveFieldMutation',
// This class need a strong refactor
'dev.vox.platform.kahpp.test.instance.InstanceTest',
]
}
}
}
}
jacocoTestCoverageVerification.dependsOn(jacocoTestReport, test)
check.dependsOn(jacocoTestCoverageVerification)
coverallsJacoco {
reportPath = file("$rootBuildDir/reports/jacoco/test/jacocoTestReport.xml")
}
spotless {
java {
googleJavaFormat()
removeUnusedImports()
trimTrailingWhitespace()
}
}
publishing {
repositories {
maven {
name = 'githubRepository'
url = uri('https://maven.pkg.github.com/getfeedback/kahpp-oss')
credentials(PasswordCredentials)
}
}
}
signing {
if (project.hasProperty("signJar")) {
useInMemoryPgpKeys(System.getenv('PGP_KEY'), System.getenv('PGP_PSW'))
sign publishing.publications
}
}
}
spotless {
groovyGradle {
greclipse()
indentWithSpaces()
}
}
dependencyCheck {
failBuildOnCVSS = 4.0
suppressionFile = "$root/config/dependency-check-suppression.xml"
}