| 1 | apply plugin: 'eclipse'
|
|---|
| 2 | apply plugin: 'findbugs'
|
|---|
| 3 | apply plugin: 'jacoco'
|
|---|
| 4 | apply plugin: 'java'
|
|---|
| 5 | apply plugin: 'project-report'
|
|---|
| 6 |
|
|---|
| 7 | sourceCompatibility = '1.7'
|
|---|
| 8 |
|
|---|
| 9 | configurations {
|
|---|
| 10 | packIntoJar
|
|---|
| 11 | compile.extendsFrom packIntoJar
|
|---|
| 12 | }
|
|---|
| 13 | repositories {
|
|---|
| 14 | // for JUnit
|
|---|
| 15 | mavenCentral()
|
|---|
| 16 | // for commons-imaging
|
|---|
| 17 | maven {
|
|---|
| 18 | url "https://repository.apache.org/content/repositories/snapshots/"
|
|---|
| 19 | }
|
|---|
| 20 | // for scribe-java
|
|---|
| 21 | maven {
|
|---|
| 22 | url "https://raw.github.com/fernandezpablo85/scribe-java/mvn-repo/"
|
|---|
| 23 | }
|
|---|
| 24 | //for josm-(latest|tested).jar
|
|---|
| 25 | ivy {
|
|---|
| 26 | url "https://josm.openstreetmap.de/download/"
|
|---|
| 27 | layout "pattern", {
|
|---|
| 28 | artifact "[artifact]-[revision].jar"
|
|---|
| 29 | }
|
|---|
| 30 | }
|
|---|
| 31 | }
|
|---|
| 32 | dependencies {
|
|---|
| 33 | // The JOSM-version can be specified as "latest", "tested" or "snapshot-1234" (replace 1234 by the desired version numbers).
|
|---|
| 34 | // For revisions older than the last ~60 versions, also append "Archiv" to the repository URL above
|
|---|
| 35 | packIntoJar 'org.scribe:scribe:1.3.7'
|
|---|
| 36 |
|
|---|
| 37 | compile 'org.openstreetmap.josm:josm:latest'
|
|---|
| 38 | compile 'org.apache.commons:commons-imaging:1.0-SNAPSHOT'
|
|---|
| 39 |
|
|---|
| 40 | testCompile 'junit:junit:4.12'
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | sourceSets {
|
|---|
| 44 | main {
|
|---|
| 45 | java {
|
|---|
| 46 | srcDirs = ['src']
|
|---|
| 47 | }
|
|---|
| 48 | resources {
|
|---|
| 49 | srcDirs = ["$projectDir"]
|
|---|
| 50 | include 'data/**'
|
|---|
| 51 | include 'images/**'
|
|---|
| 52 | include 'README'
|
|---|
| 53 | include 'GPL-v*.txt'
|
|---|
| 54 | }
|
|---|
| 55 | }
|
|---|
| 56 | test {
|
|---|
| 57 | java {
|
|---|
| 58 | srcDirs = ['test/unit']
|
|---|
| 59 | }
|
|---|
| 60 | resources{
|
|---|
| 61 | srcDirs = ['test/data']
|
|---|
| 62 | }
|
|---|
| 63 | }
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | build.dependsOn jacocoTestReport
|
|---|
| 67 | build.dependsOn projectReport
|
|---|
| 68 |
|
|---|
| 69 | /** Eclipse configuration */
|
|---|
| 70 | eclipse {
|
|---|
| 71 | classpath {
|
|---|
| 72 | downloadSources=true
|
|---|
| 73 | downloadJavadoc=true
|
|---|
| 74 | }
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | /** FindBugs configuration */
|
|---|
| 78 | findbugs {
|
|---|
| 79 | toolVersion = "3.0.1"
|
|---|
| 80 | ignoreFailures = true
|
|---|
| 81 | effort = "min"
|
|---|
| 82 | reportLevel = "high"
|
|---|
| 83 | }
|
|---|
| 84 | tasks.withType(FindBugs) {
|
|---|
| 85 | reports {
|
|---|
| 86 | xml.enabled = false
|
|---|
| 87 | html.enabled = true
|
|---|
| 88 | }
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | /** JaCoCo configuration */
|
|---|
| 92 | jacoco {
|
|---|
| 93 | toolVersion = "0.7.5.201505241946"
|
|---|
| 94 | }
|
|---|
| 95 | jacocoTestReport {
|
|---|
| 96 | reports {
|
|---|
| 97 | xml.enabled true
|
|---|
| 98 | html.destination "$buildDir/reports/jacoco"
|
|---|
| 99 | }
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | test {
|
|---|
| 103 | testLogging {
|
|---|
| 104 | exceptionFormat "full"
|
|---|
| 105 | events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|---|
| 106 | }
|
|---|
| 107 | }
|
|---|
| 108 |
|
|---|
| 109 | jar {
|
|---|
| 110 | from zipTree(configurations.packIntoJar.singleFile)
|
|---|
| 111 | manifest {
|
|---|
| 112 | attributes("Plugin-Mainversion": "8433",
|
|---|
| 113 | "Plugin-Version": "31395",
|
|---|
| 114 | "Plugin-Class": "org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin",
|
|---|
| 115 | "Plugin-Description": "Enables user to work with pictures hosted at mapillary.com",
|
|---|
| 116 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
|---|
| 117 | "Author": "nokutu <nokutu@openmailbox.org>",
|
|---|
| 118 | "Plugin-Link": "https://wiki.openstreetmap.org/wiki/JOSM/Plugins/Mapillary",
|
|---|
| 119 | "Plugin-Icon": "images/icon24.png",
|
|---|
| 120 | "Plugin-Requires": "commons-imaging",
|
|---|
| 121 | "Plugin-Canloadatruntime": "true")
|
|---|
| 122 | }
|
|---|
| 123 | }
|
|---|
| 124 |
|
|---|
| 125 | /**
|
|---|
| 126 | * The following are tasks to directly run JOSM with the freshly-built
|
|---|
| 127 | * Mapillary-plugin already installed.
|
|---|
| 128 | * Only prerequisite is to have JOSM (or JOSM-latest) installed on your machine.
|
|---|
| 129 | * Previously installed versions of the plugin are overridden by executions of these tasks.
|
|---|
| 130 | **/
|
|---|
| 131 |
|
|---|
| 132 | task installPluginToJosm(type: Copy) {
|
|---|
| 133 | from "$buildDir/libs/josm-mapillary-plugin.jar"
|
|---|
| 134 | into "$System.env.HOME/.josm/plugins"
|
|---|
| 135 | rename '.*', 'Mapillary.jar'
|
|---|
| 136 | }
|
|---|
| 137 | installPluginToJosm.dependsOn jar
|
|---|
| 138 |
|
|---|
| 139 | task runJosm(type: Exec) {
|
|---|
| 140 | commandLine 'josm'
|
|---|
| 141 | }
|
|---|
| 142 | runJosm.dependsOn installPluginToJosm
|
|---|
| 143 |
|
|---|
| 144 | task installPluginToJosmLatest(type: Copy) {
|
|---|
| 145 | from "$buildDir/libs/josm-mapillary-plugin.jar"
|
|---|
| 146 | into "$System.env.HOME/.josm-latest/plugins"
|
|---|
| 147 | rename '.*', 'Mapillary.jar'
|
|---|
| 148 | }
|
|---|
| 149 | installPluginToJosmLatest.dependsOn jar
|
|---|
| 150 |
|
|---|
| 151 | task runJosmLatest(type: Exec) {
|
|---|
| 152 | commandLine 'josm-latest'
|
|---|
| 153 | }
|
|---|
| 154 | runJosmLatest.dependsOn installPluginToJosmLatest
|
|---|
| 155 |
|
|---|
| 156 | /** Wrapper task:
|
|---|
| 157 | * This only needs to be run once when the Gradle version changes.
|
|---|
| 158 | * The changed files (probably in the gradle/-folder) should then be commited to CVS.
|
|---|
| 159 | */
|
|---|
| 160 | task wrapper(type: Wrapper) {
|
|---|
| 161 | gradleVersion = '2.5'
|
|---|
| 162 | }
|
|---|