-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
140 lines (121 loc) · 3.79 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
plugins {
id "org.springframework.boot" version "3.1.5" apply false
id "io.spring.dependency-management" version "1.1.3" apply false
id "com.diffplug.spotless" version "5.12.5" apply false
id "com.github.spotbugs" version "5.2.1" apply false
}
ext {
lombokVersion="1.18.30"
}
subprojects {
// More about applying plugins in subprojects read here:
// https://discuss.gradle.org/t/cannot-use-plugins-block-inside-subprojects-block/13570
apply plugin: "java"
apply plugin: "java-library"
apply plugin: "io.spring.dependency-management"
apply plugin: "pmd"
apply plugin: "checkstyle"
apply plugin: "com.diffplug.spotless"
apply plugin: "com.github.spotbugs"
apply plugin: "jacoco"
group = "dev.iakunin.library"
sourceCompatibility = "17"
repositories {
mavenCentral()
mavenLocal()
}
// Adding javac linter to compileJava task.
// Taken from here https://stackoverflow.com/a/29593630/3456163
// and from here https://stackoverflow.com/a/69734707/3456163
tasks.withType(JavaCompile).configureEach {
configure(options) {
options.compilerArgs << "-Xlint:all,-serial,-processing" << "-Werror"
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
jacocoTestReport {
reports {
xml.required = false
html.required = true
}
finalizedBy jacocoTestCoverageVerification
}
jacocoTestCoverageVerification {
violationRules {
failOnViolation = false
rule {
enabled = true
limit {
minimum = 0.8
}
}
}
}
// global dependencies (for all submodules)
dependencies {
// lombok
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"
// Getting rid of "SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" error
// during `spotbugsTest` gradle-task
spotbugsSlf4j "org.slf4j:slf4j-simple:1.7.36"
}
pmd {
toolVersion = "6.55.0"
consoleOutput = true
ignoreFailures = false
rulesMinimumPriority = 5
ruleSetFiles = files("${project.rootDir}/etc/quality/pmd.xml")
ruleSets = []
}
checkstyle {
configFile file("${project.rootDir}/etc/quality/checkstyle.xml")
toolVersion "10.12.1"
maxWarnings = 0
}
checkstyleMain {
source = "src/main/java"
}
checkstyleTest {
source = "src/test/java"
}
spotless {
format "misc", {
// define the files to apply `misc` to
target "*.gradle", "*.md", ".gitignore"
trimTrailingWhitespace()
indentWithSpaces(4)
endWithNewline()
}
java {
target fileTree(".") {
include "**/*.java"
exclude "**/build/**", "**/build-*/**"
}
eclipse().configFile("${project.rootDir}/etc/quality/code-formatter.xml")
}
}
spotbugs {
ignoreFailures = false
showStackTraces = true
showProgress = true
effort = "default"
reportLevel = "default"
visitors = ["FindSqlInjection", "SwitchFallthrough"]
omitVisitors = ["FindNonShortCircuit"]
reportsDir = file("$buildDir/spotbugs")
onlyAnalyze = ["dev.iakunin.library.*"]
maxHeapSize = "1g"
extraArgs = ["-nested:false"]
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
}