[35779] | 1 | import com.github.spotbugs.snom.SpotBugsTask
|
---|
| 2 | import net.ltgt.gradle.errorprone.CheckSeverity
|
---|
| 3 |
|
---|
[34317] | 4 | plugins {
|
---|
[35779] | 5 | id 'java'
|
---|
[34317] | 6 | id 'eclipse'
|
---|
| 7 | id 'jacoco'
|
---|
| 8 | id 'pmd'
|
---|
[35779] | 9 | id("com.github.ben-manes.versions").version("0.39.0")
|
---|
| 10 | id("net.ltgt.errorprone").version("2.0.2")
|
---|
| 11 | id("org.kordamp.markdown.convert").version("1.2.0")
|
---|
| 12 | id("org.sonarqube").version("3.3")
|
---|
| 13 | id('com.github.spotbugs').version('4.7.2')
|
---|
| 14 | id('org.openstreetmap.josm').version("0.7.1")
|
---|
| 15 | id("com.diffplug.spotless").version("5.14.1")
|
---|
[34317] | 16 | }
|
---|
| 17 |
|
---|
| 18 | apply from: 'gradle/tool-config.gradle'
|
---|
[34419] | 19 | // TODO: repair Mapillary markdown task
|
---|
| 20 | // error with subdir build/markdown
|
---|
| 21 | //apply from: 'gradle/markdown.gradle'
|
---|
[34317] | 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 | jcenter()
|
---|
| 37 | mavenCentral()
|
---|
[35779] | 38 | maven {
|
---|
| 39 | url "https://josm.openstreetmap.de/nexus/content/repositories/releases/"
|
---|
| 40 | }
|
---|
[34317] | 41 | }
|
---|
| 42 |
|
---|
[35779] | 43 | def versions = [
|
---|
| 44 | awaitility: "4.1.0",
|
---|
| 45 | jackson: "2.12.4",
|
---|
| 46 | jmockit: "1.49.a",
|
---|
| 47 | junit: "5.7.1",
|
---|
| 48 | wiremock: "2.27.2"
|
---|
| 49 | ]
|
---|
| 50 |
|
---|
[34317] | 51 | dependencies {
|
---|
[35779] | 52 | if (!JavaVersion.current().isJava9Compatible()) {
|
---|
| 53 | errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
|
---|
| 54 | }
|
---|
| 55 | implementation "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
|
---|
| 56 | implementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
|
---|
| 57 | implementation "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
|
---|
| 58 | implementation "us.monoid.web:resty:0.3.2"
|
---|
| 59 | implementation "log4j:log4j:1.2.17"
|
---|
| 60 | testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}")
|
---|
| 61 | testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}")
|
---|
| 62 | testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}")
|
---|
| 63 | testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}")
|
---|
| 64 | testImplementation ("org.openstreetmap.josm:josm-unittest"){changing=true}
|
---|
| 65 | testImplementation "com.github.tomakehurst:wiremock:${versions.wiremock}"
|
---|
| 66 | testImplementation("org.jmockit:jmockit:${versions.jmockit}")
|
---|
| 67 | testImplementation("org.awaitility:awaitility:${versions.awaitility}")
|
---|
[34317] | 68 | }
|
---|
| 69 |
|
---|
| 70 | sourceSets {
|
---|
| 71 | main {
|
---|
| 72 | java {
|
---|
| 73 | srcDirs = ['src']
|
---|
| 74 | }
|
---|
| 75 | resources {
|
---|
| 76 | srcDirs = ["$projectDir"]
|
---|
| 77 | include 'data/**'
|
---|
| 78 | include 'images/**'
|
---|
| 79 | include 'LICENSE'
|
---|
| 80 | include 'LICENSE_*'
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 | test {
|
---|
| 84 | java {
|
---|
| 85 | srcDirs = ['test/unit']
|
---|
| 86 | }
|
---|
| 87 | resources{
|
---|
| 88 | srcDirs = ['test/data']
|
---|
| 89 | }
|
---|
| 90 | }
|
---|
| 91 | }
|
---|
| 92 |
|
---|
[35779] | 93 | spotless {
|
---|
| 94 | enforceCheck = false
|
---|
| 95 | format("misc") {
|
---|
| 96 | target("**/*.gradle", "**.*.md", "**/.gitignore")
|
---|
| 97 |
|
---|
| 98 | trimTrailingWhitespace()
|
---|
| 99 | indentWithSpaces(2)
|
---|
| 100 | endWithNewline()
|
---|
[34317] | 101 | }
|
---|
[35779] | 102 | java {
|
---|
| 103 | trimTrailingWhitespace()
|
---|
| 104 | indentWithSpaces(2)
|
---|
| 105 | endWithNewline()
|
---|
| 106 | removeUnusedImports()
|
---|
[34317] | 107 | }
|
---|
| 108 | }
|
---|
| 109 |
|
---|
[35779] | 110 | josm {
|
---|
| 111 | debugPort = 7051
|
---|
| 112 | }
|
---|
| 113 |
|
---|
[34317] | 114 | eclipse {
|
---|
| 115 | project {
|
---|
| 116 | name = 'MicrosoftStreetside'
|
---|
| 117 | comment = josm.manifest.description
|
---|
| 118 | natures 'org.sonarlint.eclipse.core.sonarlintNature', 'ch.acanda.eclipse.pmd.builder.PMDNature', 'org.eclipse.buildship.core.gradleprojectnature'
|
---|
| 119 | buildCommand 'org.sonarlint.eclipse.core.sonarlintBuilder'
|
---|
| 120 | buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
|
---|
| 121 | buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
|
---|
| 122 | }
|
---|
| 123 | }
|
---|
| 124 | eclipseClasspath.dependsOn cleanEclipseClasspath
|
---|
| 125 | eclipseProject.dependsOn cleanEclipseProject
|
---|
| 126 | tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
|
---|
| 127 |
|
---|
| 128 | tasks.withType(JavaCompile) {
|
---|
| 129 | // Character encoding of Java files
|
---|
| 130 | options.encoding = 'UTF-8'
|
---|
| 131 | }
|
---|
| 132 | tasks.withType(Javadoc) {
|
---|
| 133 | failOnError false
|
---|
| 134 | }
|
---|
[35779] | 135 | tasks.withType(SpotBugsTask) {
|
---|
[34317] | 136 | reports {
|
---|
| 137 | xml.enabled = false
|
---|
| 138 | html.enabled = true
|
---|
| 139 | }
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | import org.gradle.api.tasks.testing.logging.TestLogEvent
|
---|
| 143 |
|
---|
| 144 | test {
|
---|
[35779] | 145 | project.afterEvaluate {
|
---|
| 146 | jvmArgs("-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}")
|
---|
| 147 | }
|
---|
| 148 | useJUnitPlatform()
|
---|
[34317] | 149 | testLogging {
|
---|
| 150 | exceptionFormat "full"
|
---|
| 151 | events TestLogEvent.FAILED, TestLogEvent.SKIPPED
|
---|
| 152 | showCauses true
|
---|
| 153 |
|
---|
| 154 | info {
|
---|
| 155 | events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR
|
---|
| 156 | showStandardStreams = true
|
---|
| 157 | }
|
---|
| 158 | }
|
---|
| 159 | }
|
---|