-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
198 lines (174 loc) · 6.33 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
/*
* Copyright (C) 2015 The Simlar Authors.
*
* This file is part of Simlar. (https://www.simlar.org)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
//file:noinspection UnnecessaryQualifiedReference
plugins {
id "java"
id "eclipse"
id "idea"
id "war"
id "pmd"
id "com.github.spotbugs" version "6.0.26"
id "org.springframework.boot" version "3.3.5"
id "io.spring.dependency-management" version "1.1.6"
id "com.github.ben-manes.versions" version "0.51.0"
id "org.owasp.dependencycheck" version "11.1.0"
}
ext {
lombokVersion = "1.18.34"
spotbugsVersion = "4.8.6"
}
ext['log4j2.version'] = '2.17.1'
dependencies {
annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
compileOnly("org.projectlombok:lombok:${lombokVersion}")
testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
testCompileOnly("org.projectlombok:lombok:${lombokVersion}")
compileOnly("com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}")
testCompileOnly("com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}")
spotbugs("com.github.spotbugs:spotbugs:${spotbugsVersion}")
spotbugsPlugins("com.mebigfatguy.sb-contrib:sb-contrib:7.6.6") { transitive = false }
spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0")
//noinspection GradlePackageVersionRange, GradlePackageUpdate /// managed by spring boot bom
implementation("org.springframework.boot:spring-boot-starter-web-services")
//noinspection GradlePackageVersionRange, GradlePackageUpdate /// managed by spring boot bom
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.apache.commons:commons-lang3:3.17.0")
implementation("org.apache.commons:commons-text:1.12.0")
implementation("org.apache.commons:commons-collections4:4.4")
implementation("commons-codec:commons-codec:1.17.1")
implementation("com.googlecode.libphonenumber:libphonenumber:8.13.49")
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.google.auth:google-auth-library-oauth2-http:1.29.0")
implementation("org.yaml:snakeyaml:2.3") /// TODO: remove this once transitive dependency passes owasp checker
runtimeOnly("org.mariadb.jdbc:mariadb-java-client:2.7.12")
//noinspection GradlePackageVersionRange, GradlePackageUpdate /// managed by spring boot bom
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
testImplementation("junit:junit:4.13.2")
//noinspection VulnerableLibrariesLocal
testImplementation("com.h2database:h2:1.4.200")
//noinspection GradlePackageVersionRange, GradlePackageUpdate /// managed by spring boot bom
testImplementation("org.springframework.boot:spring-boot-starter-test")
//noinspection VulnerableLibrariesLocal
testImplementation("org.mock-server:mockserver-netty:5.15.0")
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
repositories {
mavenCentral()
}
pmd {
toolVersion = "6.55.0"
ruleSetFiles = files("pmd-ruleset.xml")
ruleSets = []
}
spotbugs {
effort = com.github.spotbugs.snom.Effort.MAX
reportLevel = com.github.spotbugs.snom.Confidence.valueOf("LOW")
// implemented like the documentation suggests:
// https://github.com/spotbugs/spotbugs-gradle-plugin#readme
//noinspection GroovyAssignabilityCheck,GrFinalVariableAccess
excludeFilter = file("$rootProject.projectDir/ides/spotbugs/excludeFilter.xml")
}
gradle.taskGraph.beforeTask { task ->
if (task.name.toLowerCase().contains('spotbugs')) {
task.reports {
html.enabled = true
xml.enabled = false
}
}
}
dependencyCheck {
suppressionFile = "owasp-dependency-check-suppression.xml"
failBuildOnCVSS = 0
def nvdApiKey = System.getenv("SIMLAR_NVD_API_KEY")
if (nvdApiKey != null) {
println("This product uses the NVD API but is not endorsed or certified by the NVD.")
nvd {
apiKey = "${nvdApiKey}"
delay = 16000
}
}
}
//noinspection GroovyAssignabilityCheck
tasks.register('dependencyChecks') {
}
dependencyChecks.dependsOn dependencyCheckAnalyze
dependencyChecks.dependsOn dependencyUpdates
processResources {
filesMatching("**/application.properties") {
expand(project.properties)
}
}
//noinspection GroovyMissingReturnStatement
test {
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
def getGitVersion = { ->
try {
return providers.exec {
commandLine("git", "describe", "--tags", "--always", "--dirty")
}.standardOutput.asText.get().trim()
}
catch (ignored) {
return "git-not-found"
}
}
version = getGitVersion()
tasks.named("war") {
enabled = true
archiveFileName = "simlar-server##${project.version}.war"
rootSpec.exclude("application-default.properties")
manifest {
attributes("Implementation-Version": project.version)
}
}
tasks.named("bootWar") {
rootSpec.exclude("application-default.properties")
manifest {
attributes("Implementation-Version": project.version)
}
}
tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
springBoot {
buildInfo {
properties {
excludes = ['time']
}
}
}
idea {
module {
/// IntelliJ inspection excludes
excludeDirs += file("ides")
excludeDirs += file("examples")
excludeDirs += file("pmd-ruleset.xml")
excludeDirs += file("owasp-dependency-check-suppression.xml")
excludeDirs += file("gradlew.bat")
excludeDirs += file("gradlew")
}
}