-
Notifications
You must be signed in to change notification settings - Fork 107
/
build.gradle.kts
190 lines (163 loc) · 5.41 KB
/
build.gradle.kts
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
import com.github.spotbugs.SpotBugsTask
buildscript {
repositories {
jcenter()
maven {
setUrl("https://github.com/WPIRoboticsProjects/opencv-maven/raw/mvn-repo")
}
}
dependencies {
classpath(group = "edu.wpi.first.wpilib.opencv", name = "opencv-installer", version = "2.0.1")
classpath("com.netflix.nebula:gradle-aggregate-javadocs-plugin:3.0.1")
}
}
plugins {
java
jacoco
checkstyle
pmd
id("com.github.johnrengelman.shadow") version "5.1.0"
id("com.google.osdetector") version "1.6.2"
id("org.ajoberstar.grgit") version "3.1.1" apply false
//id("net.ltgt.errorprone") version "0.0.16"
id("com.github.spotbugs") version "2.0.0"
id("com.gradle.build-scan") version "2.4.2"
}
apply {
plugin("nebula-aggregate-javadocs")
}
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
repositories {
mavenCentral()
jcenter()
}
tasks.withType<Wrapper>().configureEach {
gradleVersion = "5.6.3"
distributionType = Wrapper.DistributionType.ALL
}
fun javaSubprojects(action: Project.() -> Unit) {
subprojects.minus(project(":ui:linuxLauncher")).forEach { project ->
project.action()
}
}
javaSubprojects {
apply {
plugin("java")
plugin("org.gradle.jacoco")
plugin("org.gradle.pmd")
plugin("org.gradle.checkstyle")
//plugin("net.ltgt.errorprone")
plugin("com.github.spotbugs")
}
repositories {
mavenCentral()
jcenter()
maven {
name = "WPILib Maven Release"
setUrl("https://frcmaven.wpi.edu/artifactory/release")
}
maven {
name = "rosjava Maven"
setUrl("https://github.com/rosjava/rosjava_mvn_repo/raw/master")
}
maven {
name = "GRIP ROS Maven"
setUrl("https://github.com/WPIRoboticsProjects/rosjava_mvn_repo/raw/master")
}
}
version = getGitVersion()
dependencies {
"compile"(group = "javax.annotation", name = "javax.annotation-api", version = "1.3.2")
"annotationProcessor"(group = "javax.annotation", name = "javax.annotation-api", version = "1.3.2")
"compile"(group = "com.google.code.findbugs", name = "annotations", version = "3.0.1")
"testCompile"(group = "net.jodah", name = "concurrentunit", version = "0.4.6")
"testCompile"(group = "org.hamcrest", name = "hamcrest-all", version = "1.3")
"testCompile"(group = "junit", name = "junit", version = "4.12")
"testCompile"(group = "com.google.truth", name = "truth", version = "1.0")
"testCompile"(group = "com.google.guava", name = "guava-testlib", version = "28.1-jre")
}
checkstyle {
toolVersion = "6.19"
if (project.hasProperty("ignoreCheckstyle")) {
isIgnoreFailures = true
}
}
pmd {
toolVersion = "6.7.0"
isConsoleOutput = true
val projectSourcesSets = [email protected]
sourceSets = listOf(projectSourcesSets["main"], projectSourcesSets["test"])
reportsDir = buildDir.resolve("reports/pmd")
ruleSetFiles = files(rootDir.resolve("pmd-ruleset.xml"))
ruleSets = emptyList()
}
// configurations["errorprone"].apply {
// resolutionStrategy.force("com.google.errorprone:error_prone_core:2.3.2")
// }
spotbugs {
toolVersion = "3.1.12"
val javaSources = [email protected]
sourceSets = setOf(javaSources["main"], javaSources["test"])
excludeFilter = file("$rootDir/findBugsSuppressions.xml")
effort = "max"
}
tasks.withType<SpotBugsTask> {
reports {
xml.isEnabled = false
emacs.isEnabled = true
}
finalizedBy(task("${name}Report") {
mustRunAfter(this@withType)
doLast {
this@withType
.reports
.emacs
.destination
.takeIf { it.exists() }
?.readText()
.takeIf { !it.isNullOrBlank() }
?.also { logger.warn(it) }
}
})
}
tasks.named<JacocoReport>("jacocoTestReport") {
reports {
html.isEnabled = true
xml.isEnabled = true
}
}
tasks.withType<Javadoc> {
source(tasks.named<JavaCompile>("compileJava").map { it.source })
}
tasks.named("check").configure {
dependsOn("javadoc")
}
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = "8"
}
}
tasks.register<JacocoReport>("jacocoRootReport") {
group = "Coverage reports"
description = "Generates an aggregate report from all subprojects"
// Based on the codecov Gradle example: https://github.com/codecov/example-gradle
javaSubprojects {
[email protected](sourceSets["main"])
[email protected](tasks.named<JacocoReport>("jacocoTestReport"))
}
executionData(fileTree(rootDir.absolutePath).include("**/build/jacoco/*.exec"))
reports {
xml.isEnabled = true
xml.destination = buildDir.resolve("reports/jacoco/report.xml")
html.isEnabled = false
csv.isEnabled = false
}
}
allprojects {
tasks.withType<Javadoc> {
options.encoding = "UTF-8"
isFailOnError = true
}
}