1 | import com.github.spotbugs.snom.Confidence
|
---|
2 | import com.github.spotbugs.snom.Effort
|
---|
3 | import com.github.spotbugs.snom.SpotBugsTask
|
---|
4 | import org.gradle.api.tasks.testing.logging.TestLogEvent
|
---|
5 |
|
---|
6 | plugins {
|
---|
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 |
|
---|
21 | apply from: 'gradle/tool-config.gradle'
|
---|
22 | // TODO: repair Mapillary markdown task
|
---|
23 | // error with subdir build/markdown
|
---|
24 | //apply from: 'gradle/markdown.gradle'
|
---|
25 |
|
---|
26 | sourceCompatibility = '21'
|
---|
27 |
|
---|
28 | def versionProcess = new ProcessBuilder("git", "describe", "--always", "--dirty").start()
|
---|
29 | versionProcess.waitFor()
|
---|
30 | if (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 | }
|
---|
36 | archivesBaseName = 'MicrosoftStreetside'
|
---|
37 |
|
---|
38 | repositories {
|
---|
39 | mavenCentral()
|
---|
40 | maven {
|
---|
41 | url "https://josm.openstreetmap.de/nexus/content/repositories/releases/"
|
---|
42 | }
|
---|
43 | }
|
---|
44 |
|
---|
45 | javafx {
|
---|
46 | modules = [ 'javafx.graphics', 'javafx.controls', 'javafx.swing' ]
|
---|
47 | }
|
---|
48 |
|
---|
49 | dependencies {
|
---|
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 |
|
---|
60 | sourceSets {
|
---|
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
|
---|
84 | spotbugs {
|
---|
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 |
|
---|
92 | spotless {
|
---|
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 |
|
---|
109 | josm {
|
---|
110 | debugPort = 7051
|
---|
111 | }
|
---|
112 |
|
---|
113 | eclipse {
|
---|
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 | }
|
---|
123 | eclipseClasspath.dependsOn cleanEclipseClasspath
|
---|
124 | eclipseProject.dependsOn cleanEclipseProject
|
---|
125 | tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
|
---|
126 |
|
---|
127 | tasks.withType(JavaCompile) {
|
---|
128 | // Character encoding of Java files
|
---|
129 | options.encoding = 'UTF-8'
|
---|
130 | }
|
---|
131 | tasks.withType(Javadoc) {
|
---|
132 | failOnError false
|
---|
133 | }
|
---|
134 | tasks.withType(SpotBugsTask) {
|
---|
135 | reports {
|
---|
136 | xml.enabled = false
|
---|
137 | html.enabled = true
|
---|
138 | }
|
---|
139 | }
|
---|
140 |
|
---|
141 | test {
|
---|
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 | }
|
---|