-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
147 lines (124 loc) · 3.72 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
plugins {
id 'nebula.lint' version '20.3.0'
id 'jacoco-report-aggregation'
}
dependencies {
subprojects.forEach {
jacocoAggregation it
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}
apply plugin: 'maven-publish'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'nebula.lint'
apply plugin: 'jacoco-report-aggregation'
group 'no.unit.nva'
version '0.5.10'
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
gradleLint.rules = ['unused-dependency']
def junit5Version = '5.11.3'
dependencies {
implementation group: 'jakarta.xml.bind', name: 'jakarta.xml.bind-api', version: '4.0.2'
testImplementation group: 'org.hamcrest', name: 'hamcrest', version: '3.0'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junit5Version
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junit5Version
testRuntimeOnly group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.11.3'
}
test {
useJUnitPlatform()
failFast = true
testLogging {
events = ['skipped', 'passed', 'failed']
}
finalizedBy jacocoTestReport
}
jacocoTestReport {
reports {
xml.required = true
}
}
pmd {
ruleSetConfig = rootProject.resources.text.fromFile('config/pmd/ruleset.xml')
ruleSets = []
ignoreFailures = false
toolVersion = "7.8.0"
}
tasks.withType(Pmd).configureEach {
exclude '**/org/datacite/schema/**'
}
checkstyle {
configFile = rootProject.resources.text.fromFile('config/checkstyle/checkstyle.xml').asFile()
showViolations = true
}
tasks.withType(Checkstyle).configureEach {
exclude '**/org/datacite/schema/**'
}
tasks.withType(Checkstyle).configureEach {
reports {
xml.required = false
html.required = true
html.stylesheet rootProject.resources.text.fromFile('config/checkstyle/checkstyle-simple.xsl')
}
}
check.dependsOn(jacocoTestCoverageVerification)
jacocoTestCoverageVerification.dependsOn(jacocoTestReport)
jacocoTestCoverageVerification {
violationRules {
rule {
excludes = ['**datacite**']
limit {
counter = 'METHOD'
value = 'COVEREDRATIO'
minimum = 1.00
}
}
rule {
excludes = ['**datacite**']
limit {
counter = 'CLASS'
value = 'COVEREDRATIO'
minimum = 1.00
}
}
}
}
tasks.named('check') {
dependsOn tasks.named('testCodeCoverageReport', JacocoReport)
}
reporting {
reports {
testCodeCoverageReport(JacocoCoverageReport) {
testType = TestSuiteType.UNIT_TEST
}
}
}
java {
withSourcesJar()
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
}
}