apply plugin: 'eclipse' apply plugin: 'findbugs' apply plugin: 'jacoco' apply plugin: 'java' apply plugin: 'project-report' sourceCompatibility = '1.7' repositories { // for JUnit mavenCentral() //for josm-(latest|tested).jar ivy { url 'https://josm.openstreetmap.de/download' layout 'pattern', { artifact "[artifact]-[revision].jar" artifact "[artifact]-snapshot-[revision].jar" artifact "Archiv/[artifact]-snapshot-[revision].jar" } } //for josm-plugins ivy { url "https://svn.openstreetmap.org/applications/editors/josm/dist/" layout "pattern", { artifact "[artifact].jar" } } } dependencies { // The JOSM-version can be specified as "latest", "tested" or the numeric version number. // When using a numeric version number you can leave out {changing=true}. compile(':josm:latest'){changing=true} // For plugins it's irrelevant, which version is specified, always the latest version is used. compile (':apache-commons:latest'){changing=true} compile (':apache-http:latest'){changing=true} testCompile 'junit:junit:4.12' } sourceSets { main { java { srcDirs = ['src'] } resources { srcDirs = ["$projectDir"] include 'data/**' include 'images/**' include 'README' include 'GPL-v*.txt' } } test { java { srcDirs = ['test/unit'] } resources{ srcDirs = ['test/data'] } } } eclipse { project { name = 'JOSM-Mapillary' natures 'org.sonarlint.eclipse.core.sonarlintNature' } } build.dependsOn jacocoTestReport build.dependsOn projectReport /** FindBugs configuration */ findbugs { toolVersion = "3.0.1" ignoreFailures = true effort = "min" reportLevel = "high" } tasks.withType(FindBugs) { reports { xml.enabled = false html.enabled = true } } /** JaCoCo configuration */ jacoco { toolVersion = "0.7.5.201505241946" } jacocoTestReport { reports { xml.enabled true html.destination "$buildDir/reports/jacoco" } } test { testLogging { exceptionFormat "full" events "started", "passed", "skipped", "failed", "standardOut", "standardError" } } jar { manifest { attributes("Plugin-Mainversion": project.property('plugin.main.version'), "Plugin-Version": "31802", "Plugin-Class": project.property('plugin.class'), "Plugin-Description": project.property('plugin.description'), "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()), "Author": project.property('plugin.author'), "Plugin-Link": project.property('plugin.link'), "Plugin-Icon": project.property("plugin.icon"), "Plugin-Requires": project.property("plugin.requires"), "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime')) } } task activatePlugin(type: Copy) { from "gradle/josm-preferences.xml" into "$buildDir/.josm" rename 'josm-preferences.xml', 'preferences.xml' } task installPlugin(type: Copy) { from "$buildDir/libs/${project.name}.jar" from configurations.runtime into "$buildDir/.josm/plugins" include 'apache*.jar' include "${project.name}.jar" rename "${project.name}.jar", 'Mapillary.jar' rename 'apache-(.*)-.*.jar', 'apache-$1.jar' } installPlugin.dependsOn jar installPlugin.dependsOn activatePlugin /** * This runs the JOSM-version specified in the dependency configuration above. * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations. */ task runJosm(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'JOSM' args '--offline=josm_website' jvmArgs "-Djosm.home=$buildDir/.josm" } runJosm.dependsOn installPlugin