| 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 | repositories {
|
|---|
| 10 | // for JUnit
|
|---|
| 11 | mavenCentral()
|
|---|
| 12 | //for josm-(latest|tested).jar
|
|---|
| 13 | ivy {
|
|---|
| 14 | url 'https://josm.openstreetmap.de/download'
|
|---|
| 15 | layout 'pattern', {
|
|---|
| 16 | artifact "[artifact]-[revision].jar"
|
|---|
| 17 | artifact "[artifact]-snapshot-[revision].jar"
|
|---|
| 18 | artifact "Archiv/[artifact]-snapshot-[revision].jar"
|
|---|
| 19 | }
|
|---|
| 20 | }
|
|---|
| 21 | //for josm-plugins
|
|---|
| 22 | ivy {
|
|---|
| 23 | url "https://svn.openstreetmap.org/applications/editors/josm/dist/"
|
|---|
| 24 | layout "pattern", {
|
|---|
| 25 | artifact "[artifact].jar"
|
|---|
| 26 | }
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 | dependencies {
|
|---|
| 30 | // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
|
|---|
| 31 | compile ':josm:latest'
|
|---|
| 32 | // For plugins it's irrelevant, which version is specified, always the latest version is used.
|
|---|
| 33 | compile ':apache-commons:latest'
|
|---|
| 34 | compile ':apache-http:latest'
|
|---|
| 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 | /** FindBugs configuration */
|
|---|
| 66 | findbugs {
|
|---|
| 67 | toolVersion = "3.0.1"
|
|---|
| 68 | ignoreFailures = true
|
|---|
| 69 | effort = "min"
|
|---|
| 70 | reportLevel = "high"
|
|---|
| 71 | }
|
|---|
| 72 | tasks.withType(FindBugs) {
|
|---|
| 73 | reports {
|
|---|
| 74 | xml.enabled = false
|
|---|
| 75 | html.enabled = true
|
|---|
| 76 | }
|
|---|
| 77 | }
|
|---|
| 78 |
|
|---|
| 79 | /** JaCoCo configuration */
|
|---|
| 80 | jacoco {
|
|---|
| 81 | toolVersion = "0.7.5.201505241946"
|
|---|
| 82 | }
|
|---|
| 83 | jacocoTestReport {
|
|---|
| 84 | reports {
|
|---|
| 85 | xml.enabled true
|
|---|
| 86 | html.destination "$buildDir/reports/jacoco"
|
|---|
| 87 | }
|
|---|
| 88 | }
|
|---|
| 89 |
|
|---|
| 90 | test {
|
|---|
| 91 | testLogging {
|
|---|
| 92 | exceptionFormat "full"
|
|---|
| 93 | events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|---|
| 94 | }
|
|---|
| 95 | }
|
|---|
| 96 |
|
|---|
| 97 | jar {
|
|---|
| 98 | manifest {
|
|---|
| 99 | attributes("Plugin-Mainversion": project.property('plugin.main.version'),
|
|---|
| 100 | "Plugin-Version": "31784",
|
|---|
| 101 | "Plugin-Class": project.property('plugin.class'),
|
|---|
| 102 | "Plugin-Description": project.property('plugin.description'),
|
|---|
| 103 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
|---|
| 104 | "Author": project.property('plugin.author'),
|
|---|
| 105 | "Plugin-Link": project.property('plugin.link'),
|
|---|
| 106 | "Plugin-Icon": project.property("plugin.icon"),
|
|---|
| 107 | "Plugin-Requires": project.property("plugin.requires"),
|
|---|
| 108 | "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime'))
|
|---|
| 109 | }
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 | task activatePlugin(type: Copy) {
|
|---|
| 113 | from "gradle/josm-preferences.xml"
|
|---|
| 114 | into "$buildDir/.josm"
|
|---|
| 115 | rename 'josm-preferences.xml', 'preferences.xml'
|
|---|
| 116 | }
|
|---|
| 117 |
|
|---|
| 118 | task installPlugin(type: Copy) {
|
|---|
| 119 | from "$buildDir/libs/${project.name}.jar"
|
|---|
| 120 | from configurations.runtime
|
|---|
| 121 | into "$buildDir/.josm/plugins"
|
|---|
| 122 | include 'apache*.jar'
|
|---|
| 123 | include "${project.name}.jar"
|
|---|
| 124 | rename "${project.name}.jar", 'Mapillary.jar'
|
|---|
| 125 | rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
|
|---|
| 126 | }
|
|---|
| 127 | installPlugin.dependsOn jar
|
|---|
| 128 | installPlugin.dependsOn activatePlugin
|
|---|
| 129 |
|
|---|
| 130 | /**
|
|---|
| 131 | * This runs the JOSM-version specified in the dependency configuration above.
|
|---|
| 132 | * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
|
|---|
| 133 | */
|
|---|
| 134 | task runJosm(type: JavaExec) {
|
|---|
| 135 | classpath = sourceSets.main.runtimeClasspath
|
|---|
| 136 | main = 'JOSM'
|
|---|
| 137 | args '--offline=josm_website'
|
|---|
| 138 | jvmArgs "-Djosm.home=$buildDir/.josm"
|
|---|
| 139 | }
|
|---|
| 140 | runJosm.dependsOn installPlugin
|
|---|