apply plugin: 'eclipse' apply plugin: 'findbugs' apply plugin: 'jacoco' apply plugin: 'java' apply plugin: 'project-report' sourceCompatibility = '1.7' configurations { packIntoJar compile.extendsFrom packIntoJar } repositories { // for JUnit mavenCentral() // for commons-imaging maven { url "https://repository.apache.org/content/repositories/snapshots/" } // for scribe-java maven { url "https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/" } //for josm-(latest|tested).jar ivy { url "https://josm.openstreetmap.de/download/" layout "pattern", { artifact "[artifact]-[revision].jar" } } } dependencies { // The JOSM-version can be specified as "latest", "tested" or "snapshot-1234" (replace 1234 by the desired version numbers). // For revisions older than the last ~60 versions, also append "Archiv" to the repository URL above packIntoJar 'org.scribe:scribe:1.3.7' compile 'org.openstreetmap.josm:josm:latest' compile 'org.apache.commons:commons-imaging:1.0-SNAPSHOT' 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'] } } } build.dependsOn jacocoTestReport build.dependsOn projectReport /** Eclipse configuration */ eclipse { classpath { downloadSources=true downloadJavadoc=true } } /** 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 { from zipTree(configurations.packIntoJar.singleFile) manifest { attributes("Plugin-Mainversion": "8433", "Plugin-Version": "31395", "Plugin-Class": "org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin", "Plugin-Description": "Enables user to work with pictures hosted at mapillary.com", "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()), "Author": "nokutu ", "Plugin-Link": "https://wiki.openstreetmap.org/wiki/JOSM/Plugins/Mapillary", "Plugin-Icon": "images/icon24.png", "Plugin-Requires": "commons-imaging", "Plugin-Canloadatruntime": "true") } } /** * The following are tasks to directly run JOSM with the freshly-built * Mapillary-plugin already installed. * Only prerequisite is to have JOSM (or JOSM-latest) installed on your machine. * Previously installed versions of the plugin are overridden by executions of these tasks. **/ task installPluginToJosm(type: Copy) { from "$buildDir/libs/josm-mapillary-plugin.jar" into "$System.env.HOME/.josm/plugins" rename '.*', 'Mapillary.jar' } installPluginToJosm.dependsOn jar task runJosm(type: Exec) { commandLine 'josm' } runJosm.dependsOn installPluginToJosm task installPluginToJosmLatest(type: Copy) { from "$buildDir/libs/josm-mapillary-plugin.jar" into "$System.env.HOME/.josm-latest/plugins" rename '.*', 'Mapillary.jar' } installPluginToJosmLatest.dependsOn jar task runJosmLatest(type: Exec) { commandLine 'josm-latest' } runJosmLatest.dependsOn installPluginToJosmLatest /** Wrapper task: * This only needs to be run once when the Gradle version changes. * The changed files (probably in the gradle/-folder) should then be commited to CVS. */ task wrapper(type: Wrapper) { gradleVersion = '2.5' }