This repository has been archived by the owner on Oct 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
228 lines (200 loc) · 6.39 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
import com.github.spotbugs.snom.SpotBugsTask
/*
* Copyright 2020-2023 Cyface GmbH
*
* This file is part of the Cyface API Library.
*
* The Cyface API Library 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 3 of the License, or
* (at your option) any later version.
*
* The Cyface API Library 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 the Cyface API Library. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The build gradle file for the Cyface API Library.
*
* @author Armin Schnabel
* @version 1.1.0
* @since 1.0.0
*/
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'eclipse'
id 'idea'
//noinspection SpellCheckingInspection
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id "com.github.spotbugs" version "4.7.5" apply false
// Plugin to display the Gradle task graph
//noinspection SpellCheckingInspection
id 'org.barfuin.gradle.taskinfo' version '2.1.0'
}
allprojects {
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'maven-publish'
apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'java'
apply plugin: 'java-library'
group = 'de.cyface'
version = "0.0.0" // Automatically overwritten by CI
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
checkstyle {
toolVersion = '8.31'
// use one common config file for all subprojects
configFile = project(':').file("config/checkstyle/checkstyle.xml")
//noinspection SpellCheckingInspection
configProperties = ["suppressionFile": project(':').file("config/checkstyle/suppressions.xml")]
ignoreFailures = true
showViolations = true
}
}
ext {
// If you increase this version, check if the `collector.GridFSStorageIT` breaks
// There is a bug up to version 4.4.1, scheduled to be fixed in 4.4.2
// https://github.com/vert-x3/vertx-mongo-client/issues/291
vertxVersion = '4.3.6'
slf4jVersion = '2.0.7'
commonsLangVersion = '3.12.0'
gradleWrapperVersion = '7.6.1'
// Versions of testing dependencies
junitVersion = '5.9.2'
mockitoVersion = '5.2.0'
flapdoodleVersion = '3.5.3' // major upgrade available
jacocoVersion = '0.8.9'
spotBugsPluginVersion = '1.12.0'
spotbugsToolsVersion = '4.7.3'
pmdToolsVersion = '6.55.0'
}
wrapper {
gradleVersion = "$gradleWrapperVersion"
}
dependencies {
implementation "org.slf4j:slf4j-api:$slf4jVersion"
implementation "org.apache.commons:commons-lang3:$commonsLangVersion"
// Testing Dependencies
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation "org.junit.jupiter:junit-jupiter-params" // Required for parameterized tests
testImplementation "org.mockito:mockito-core:$mockitoVersion"
testImplementation "org.mockito:mockito-junit-jupiter:$mockitoVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
spotbugsPlugins "com.h3xstream.findsecbugs:findsecbugs-plugin:$spotBugsPluginVersion"
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
// Also show assert message (e.g. on the CI) when tests fail to identify cause
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}
jacoco {
toolVersion = "$jacocoVersion"
reportsDir = file("$buildDir/reports/jacoco")
}
jacocoTestReport {
reports {
xml.enabled true
csv.enabled true
html.destination file("${buildDir}/reports/jacocoHtml")
}
}
spotbugs {
toolVersion = "$spotbugsToolsVersion"
ignoreFailures = true
excludeFilter = file("$rootProject.projectDir/config/spotbugs/excludeFilter.xml")
}
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
//pluginClasspath = project.configurations.spotbugsPlugins
}
pmd {
toolVersion = "$pmdToolsVersion"
incrementalAnalysis = true
ruleSetFiles = project(':').files('config/pmd.xml')
rulesMinimumPriority = 4
ruleSets = []
// There are so many violations and currently it is not really important in this application.
ignoreFailures = true
}
// Definitions for the maven-publish Plugin
publishing {
// The following repositories are used to publish artifacts to.
repositories {
maven {
name = 'github'
url = uri("https://maven.pkg.github.com/cyface-de/api")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD")
}
}
maven {
name = 'local'
url = "file://${rootProject.buildDir}/repo"
}
}
}
// The following repositories are used to load artifacts from.
repositories {
maven {
name = 'local'
url = "file://${rootProject.buildDir}/repo"
}
maven {
name = "github"
url = uri("https://maven.pkg.github.com/cyface-de/serializer")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD")
}
}
}
// The following needs to be wrapped in afterEvaluate. I have no idea why, but the solution is described here: https://github.com/akhikhl/gretty/issues/306
project.afterEvaluate {
java {
withJavadocJar()
withSourcesJar()
}
// Publish sources
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
// This is the configuration of the maven-publish plugin. It defines a publication
publishing {
publications {
//noinspection GroovyAssignabilityCheck
myLibrary(MavenPublication) {
//noinspection GroovyAssignabilityCheck
from components.java
}
}
}
}
}