-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
203 lines (179 loc) · 5.93 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
/*
* Copyright 2020-2024 Cyface GmbH
*
* This file is part of the Cyface Serialization.
*
* The Cyface Serialization 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 Serialization 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 Serialization. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The build gradle file for the Cyface Serialization.
*
* @author Armin Schnabel
*/
buildscript {
ext.kotlin_version = "1.7.10"
repositories {
mavenCentral()
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id 'eclipse'
id 'idea'
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'
// protobuf plugin 0.9.0-2 fail: https://github.com/google/protobuf-gradle-plugin/issues/686
id 'com.google.protobuf' version '0.8.19' apply false // Maybe keep in sync with `plugins` in `protos/build.gradle
}
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: 'kotlin'
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 {
slf4jVersion = '1.7.36' // major version available but breaks `backend.LocationMatchOperatorTest`
commonsLangVersion = '3.12.0'
sqliteDriverVersion = '3.40.1.0'
gradleWrapperVersion = '7.6.1'
protobufVersion = '3.22.2' // Keep in sync with protobufVersion in `protos/build.gradle`
cyfaceProtosVersion = '2.2.0'
// Versions of testing dependencies
junitVersion = '5.9.2'
mockitoVersion = '5.2.0'
hamcrestVersion = '2.2'
jacocoVersion = '0.8.9'
spotBugsPluginVersion = '1.12.0'
spotbugsToolsVersion = '4.7.3'
pmdToolsVersion = '6.55.0'
}
wrapper {
gradleVersion = "$gradleWrapperVersion"
}
compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
dependencies {
// Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // there is no stdlib-jdk11
// Testing Dependencies
testImplementation(platform("org.junit:junit-bom:$junitVersion"))
testImplementation "org.junit.jupiter:junit-jupiter-params" // Required for parameterized tests
testImplementation "org.hamcrest:hamcrest:$hamcrestVersion"
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 false // not working with vertx fail() so we disable this
showStackTraces false
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")
}
// After hours of trying to fix local `./gradlew check` execution only this helped [DAT-803]
// (https://github.com/spotbugs/spotbugs-gradle-plugin/issues/32#issuecomment-779661275)
gradle.taskGraph.beforeTask { task ->
if (task.name.toLowerCase().contains('spotbugs')) {
task.reports {
xml.enabled = false
html.enabled = true
}
}
}
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/serialization")
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"
}
}
}
}