source: osm/applications/editors/josm/plugins/MicrosoftStreetside/build.gradle@ 36228

Last change on this file since 36228 was 36228, checked in by taylor.smock, 10 months ago

StreetSide: Update to official API

This also moves the plugin to Java 21 (mostly for virtual threads), reformats the
code to match the JOSM standard (4 spaces), and fixes a bunch of lint issues.

Additionally, a lot of cruft from when this plugin was copied from Mapillary was
removed. That was largely related to image import, uploading, and login.

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