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