import com.github.spotbugs.snom.SpotBugsTask import net.ltgt.gradle.errorprone.CheckSeverity plugins { id 'java' id 'eclipse' id 'jacoco' id 'pmd' id("com.github.ben-manes.versions").version("0.39.0") id("net.ltgt.errorprone").version("2.0.2") id("org.kordamp.markdown.convert").version("1.2.0") id("org.sonarqube").version("3.3") id('com.github.spotbugs').version('4.7.2') id('org.openstreetmap.josm').version("0.7.1") id("com.diffplug.spotless").version("5.14.1") } apply from: 'gradle/tool-config.gradle' // TODO: repair Mapillary markdown task // error with subdir build/markdown //apply from: 'gradle/markdown.gradle' sourceCompatibility = '1.8' def versionProcess = new ProcessBuilder("git", "describe", "--always", "--dirty").start() versionProcess.waitFor() if (versionProcess.exitValue() != 0) { logger.error("Could not determine the current version of this JOSM plugin!") version = "‹unknown›" } else { version = versionProcess.in.text.trim() } archivesBaseName = 'MicrosoftStreetside' repositories { jcenter() mavenCentral() maven { url "https://josm.openstreetmap.de/nexus/content/repositories/releases/" } } def versions = [ awaitility: "4.1.0", jackson: "2.12.4", jmockit: "1.49.a", junit: "5.7.1", wiremock: "2.27.2" ] dependencies { if (!JavaVersion.current().isJava9Compatible()) { errorproneJavac("com.google.errorprone:javac:9+181-r4173-1") } implementation "com.fasterxml.jackson.core:jackson-core:${versions.jackson}" implementation "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}" implementation "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}" implementation "us.monoid.web:resty:0.3.2" implementation "log4j:log4j:1.2.17" testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:${versions.junit}") testImplementation("org.junit.jupiter:junit-jupiter-params:${versions.junit}") testImplementation("org.junit.jupiter:junit-jupiter-api:${versions.junit}") testImplementation("org.junit.vintage:junit-vintage-engine:${versions.junit}") testImplementation ("org.openstreetmap.josm:josm-unittest"){changing=true} testImplementation "com.github.tomakehurst:wiremock:${versions.wiremock}" testImplementation("org.jmockit:jmockit:${versions.jmockit}") testImplementation("org.awaitility:awaitility:${versions.awaitility}") } sourceSets { main { java { srcDirs = ['src'] } resources { srcDirs = ["$projectDir"] include 'data/**' include 'images/**' include 'LICENSE' include 'LICENSE_*' } } test { java { srcDirs = ['test/unit'] } resources{ srcDirs = ['test/data'] } } } spotless { enforceCheck = false format("misc") { target("**/*.gradle", "**.*.md", "**/.gitignore") trimTrailingWhitespace() indentWithSpaces(2) endWithNewline() } java { trimTrailingWhitespace() indentWithSpaces(2) endWithNewline() removeUnusedImports() } } josm { debugPort = 7051 } eclipse { project { name = 'MicrosoftStreetside' comment = josm.manifest.description natures 'org.sonarlint.eclipse.core.sonarlintNature', 'ch.acanda.eclipse.pmd.builder.PMDNature', 'org.eclipse.buildship.core.gradleprojectnature' buildCommand 'org.sonarlint.eclipse.core.sonarlintBuilder' buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder' buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' } } eclipseClasspath.dependsOn cleanEclipseClasspath eclipseProject.dependsOn cleanEclipseProject tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject'] tasks.withType(JavaCompile) { // Character encoding of Java files options.encoding = 'UTF-8' } tasks.withType(Javadoc) { failOnError false } tasks.withType(SpotBugsTask) { reports { xml.enabled = false html.enabled = true } } import org.gradle.api.tasks.testing.logging.TestLogEvent test { project.afterEvaluate { jvmArgs("-javaagent:${classpath.find { it.name.contains("jmockit") }.absolutePath}") } useJUnitPlatform() testLogging { exceptionFormat "full" events TestLogEvent.FAILED, TestLogEvent.SKIPPED showCauses true info { events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR showStandardStreams = true } } }