1 | import com.github.spotbugs.snom.SpotBugsTask
|
---|
2 | import net.ltgt.gradle.errorprone.CheckSeverity
|
---|
3 |
|
---|
4 | plugins {
|
---|
5 | id 'java'
|
---|
6 | id 'eclipse'
|
---|
7 | id 'jacoco'
|
---|
8 | id 'pmd'
|
---|
9 | id("com.github.ben-manes.versions").version("0.49.0")
|
---|
10 | id("net.ltgt.errorprone").version("3.1.0")
|
---|
11 | id("org.kordamp.markdown.convert").version("1.2.0")
|
---|
12 | id("org.sonarqube").version("3.3")
|
---|
13 | id('com.github.spotbugs').version('5.2.3')
|
---|
14 | id('org.openstreetmap.josm').version("0.8.2")
|
---|
15 | id("com.diffplug.spotless").version("6.22.0")
|
---|
16 | }
|
---|
17 |
|
---|
18 | apply from: 'gradle/tool-config.gradle'
|
---|
19 | // TODO: repair Mapillary markdown task
|
---|
20 | // error with subdir build/markdown
|
---|
21 | //apply from: 'gradle/markdown.gradle'
|
---|
22 |
|
---|
23 | sourceCompatibility = '1.8'
|
---|
24 |
|
---|
25 | def versionProcess = new ProcessBuilder("git", "describe", "--always", "--dirty").start()
|
---|
26 | versionProcess.waitFor()
|
---|
27 | if (versionProcess.exitValue() != 0) {
|
---|
28 | logger.error("Could not determine the current version of this JOSM plugin!")
|
---|
29 | version = "‹unknown›"
|
---|
30 | } else {
|
---|
31 | version = versionProcess.in.text.trim()
|
---|
32 | }
|
---|
33 | archivesBaseName = 'MicrosoftStreetside'
|
---|
34 |
|
---|
35 | repositories {
|
---|
36 | mavenCentral()
|
---|
37 | maven {
|
---|
38 | url "https://josm.openstreetmap.de/nexus/content/repositories/releases/"
|
---|
39 | }
|
---|
40 | }
|
---|
41 |
|
---|
42 | def versions = [
|
---|
43 | awaitility: "4.2.0",
|
---|
44 | jmockit: "1.49.a",
|
---|
45 | junit: "5.10.1",
|
---|
46 | wiremock: "2.27.2"
|
---|
47 | ]
|
---|
48 |
|
---|
49 | dependencies {
|
---|
50 | if (!JavaVersion.current().isJava9Compatible()) {
|
---|
51 | errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
|
---|
52 | }
|
---|
53 | testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
|
---|
54 | testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
|
---|
55 | testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
|
---|
56 | testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
|
---|
57 | testImplementation ("org.openstreetmap.josm:josm-unittest"){changing=true}
|
---|
58 | testImplementation "com.github.tomakehurst:wiremock:${versions.wiremock}"
|
---|
59 | testImplementation("org.jmockit:jmockit:${versions.jmockit}")
|
---|
60 | testImplementation("org.awaitility:awaitility:${versions.awaitility}")
|
---|
61 | }
|
---|
62 |
|
---|
63 | sourceSets {
|
---|
64 | main {
|
---|
65 | java {
|
---|
66 | srcDirs = ['src']
|
---|
67 | }
|
---|
68 | resources {
|
---|
69 | srcDirs = ["$projectDir"]
|
---|
70 | include 'data/**'
|
---|
71 | include 'images/**'
|
---|
72 | include 'LICENSE'
|
---|
73 | include 'LICENSE_*'
|
---|
74 | }
|
---|
75 | }
|
---|
76 | test {
|
---|
77 | java {
|
---|
78 | srcDirs = ['test/unit']
|
---|
79 | }
|
---|
80 | resources{
|
---|
81 | srcDirs = ['test/data']
|
---|
82 | }
|
---|
83 | }
|
---|
84 | }
|
---|
85 |
|
---|
86 | spotless {
|
---|
87 | enforceCheck = false
|
---|
88 | format("misc") {
|
---|
89 | target("**/*.gradle", "**.*.md", "**/.gitignore")
|
---|
90 |
|
---|
91 | trimTrailingWhitespace()
|
---|
92 | indentWithSpaces(2)
|
---|
93 | endWithNewline()
|
---|
94 | }
|
---|
95 | java {
|
---|
96 | trimTrailingWhitespace()
|
---|
97 | indentWithSpaces(2)
|
---|
98 | endWithNewline()
|
---|
99 | removeUnusedImports()
|
---|
100 | }
|
---|
101 | }
|
---|
102 |
|
---|
103 | josm {
|
---|
104 | debugPort = 7051
|
---|
105 | }
|
---|
106 |
|
---|
107 | eclipse {
|
---|
108 | project {
|
---|
109 | name = 'MicrosoftStreetside'
|
---|
110 | comment = josm.manifest.description
|
---|
111 | natures 'org.sonarlint.eclipse.core.sonarlintNature', 'ch.acanda.eclipse.pmd.builder.PMDNature', 'org.eclipse.buildship.core.gradleprojectnature'
|
---|
112 | buildCommand 'org.sonarlint.eclipse.core.sonarlintBuilder'
|
---|
113 | buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
|
---|
114 | buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
|
---|
115 | }
|
---|
116 | }
|
---|
117 | eclipseClasspath.dependsOn cleanEclipseClasspath
|
---|
118 | eclipseProject.dependsOn cleanEclipseProject
|
---|
119 | tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
|
---|
120 |
|
---|
121 | tasks.withType(JavaCompile) {
|
---|
122 | // Character encoding of Java files
|
---|
123 | options.encoding = 'UTF-8'
|
---|
124 | }
|
---|
125 | tasks.withType(Javadoc) {
|
---|
126 | failOnError false
|
---|
127 | }
|
---|
128 | tasks.withType(SpotBugsTask) {
|
---|
129 | reports {
|
---|
130 | xml.enabled = false
|
---|
131 | html.enabled = true
|
---|
132 | }
|
---|
133 | }
|
---|
134 |
|
---|
135 | import org.gradle.api.tasks.testing.logging.TestLogEvent
|
---|
136 |
|
---|
137 | test {
|
---|
138 | project.afterEvaluate {
|
---|
139 | jvmArgs("-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}")
|
---|
140 | }
|
---|
141 | useJUnitPlatform()
|
---|
142 | testLogging {
|
---|
143 | exceptionFormat "full"
|
---|
144 | events TestLogEvent.FAILED, TestLogEvent.SKIPPED
|
---|
145 | showCauses true
|
---|
146 |
|
---|
147 | info {
|
---|
148 | events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR
|
---|
149 | showStandardStreams = true
|
---|
150 | }
|
---|
151 | }
|
---|
152 | }
|
---|