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