-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
147 lines (133 loc) · 4.38 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
import com.github.spotbugs.snom.SpotBugsTask
import net.ltgt.gradle.errorprone.CheckSeverity
plugins {
id "java"
id "eclipse"
id "jacoco"
id "maven-publish"
id "pmd"
id("com.github.spotbugs").version("5.2.1")
id("org.openstreetmap.josm").version("0.8.2")
id("net.ltgt.errorprone").version("3.1.0")
}
// Set up Errorprone
tasks.withType(JavaCompile).configureEach {
options.errorprone {
check("DefaultCharset", CheckSeverity.ERROR)
check("StringEquality", CheckSeverity.ERROR)
check("ConstantField", CheckSeverity.WARN)
check("FieldCanBeFinal", CheckSeverity.WARN)
check("LambdaFunctionalInterface", CheckSeverity.WARN)
check("MethodCanBeStatic", CheckSeverity.WARN)
check("MultiVariableDeclaration", CheckSeverity.WARN)
check("PrivateConstructorForUtilityClass", CheckSeverity.WARN)
check("UngroupedOverloads", CheckSeverity.WARN)
check("WildcardImport", CheckSeverity.WARN)
}
}
java.sourceCompatibility = JavaVersion.VERSION_1_8
def versions = [
awaitility: "4.2.0",
errorprone: "2.10.0",
jacoco : "0.8.11",
junit : "5.10.0",
pmd : "6.55.0",
spotbugs : "4.8.0",
wiremock : "2.35.1"
]
repositories {
mavenCentral()
}
dependencies {
if (!JavaVersion.current().isJava9Compatible()) {
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
}
errorprone("com.google.errorprone:error_prone_core:${versions.errorprone}")
testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
testImplementation("com.github.spotbugs:spotbugs-annotations:${versions.spotbugs}")
testImplementation("org.openstreetmap.josm:josm-unittest:"){changing=true}
testImplementation("com.github.tomakehurst:wiremock-jre8:${versions.wiremock}")
testImplementation("org.awaitility:awaitility:${versions.awaitility}")
}
// Add dependencies from ivy.xml
def ivyModule = new XmlParser().parse(new File("$projectDir/ivy.xml"))
logger.info("Dependencies from ivy.xml (added to configuration `packIntoJar`):")
ivyModule.dependencies.dependency.each {
logger.info(" * ${it.@org}:${it.@name}:${it.@rev}")
project.dependencies.packIntoJar("${it.@org}:${it.@name}:${it.@rev}")
}
test {
useJUnitPlatform()
testLogging.exceptionFormat = 'full'
systemProperty("junit.jupiter.extensions.autodetection.enabled", true)
}
sourceSets {
test {
java {
srcDirs = ["test/unit"]
}
resources {
srcDirs = ["test/data"]
}
}
}
tasks.processResources {
from("$projectDir/LICENSE")
from("$projectDir/README.md")
}
josm {
pluginName = "wikipedia"
manifest {
oldVersionDownloadLink 16398, "v1.2.0", new URL("https://josm.gitlab.io/plugin/wikipedia/dist/v1.2.0/wikipedia.jar")
oldVersionDownloadLink 14149, "v1.1.3", new URL("https://josm.gitlab.io/plugin/wikipedia/dist/v1.1.3/wikipedia.jar")
oldVersionDownloadLink 13927, "v1.1.0", new URL("https://josm.gitlab.io/plugin/wikipedia/dist/v1.1.0/wikipedia.jar")
oldVersionDownloadLink 13597, "v1.0.1", new URL("https://github.com/JOSM/wikipedia/releases/download/v1.0.1/wikipedia.jar")
oldVersionDownloadLink 12900, "34109", new URL("https://svn.openstreetmap.org/applications/editors/josm/dist/wikipedia.jar?p=34113")
oldVersionDownloadLink 12878, "33635", new URL("https://svn.openstreetmap.org/applications/editors/josm/dist/wikipedia.jar?p=33636")
}
i18n {
pathTransformer = getPathTransformer(projectDir, "gitlab.com/JOSM/plugin/wikipedia/-/blob")
}
packIntoJarFileFilter = {
it.exclude("META-INF/**", "LICENSE.txt", "module-info.class")
}
}
tasks.withType(JavaCompile) {
options.compilerArgs += [
"-Xlint:all",
"-Xlint:-serial",
]
}
// Set up JaCoCo
jacoco {
toolVersion = "${versions.jacoco}"
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
}
}
check.dependsOn jacocoTestReport
// Set up PMD
pmd {
toolVersion = versions.pmd
ignoreFailures true
ruleSets = []
ruleSetConfig = resources.text.fromFile("$projectDir/config/pmd/ruleset.xml")
sourceSets = [sourceSets.main]
}
// Set up SpotBugs
spotbugs {
toolVersion.set(versions.spotbugs)
ignoreFailures.set(true)
}
tasks.withType(SpotBugsTask) {
reports {
html.required = true
}
}