[31393] | 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 {
|
---|
[31784] | 14 | url 'https://josm.openstreetmap.de/download'
|
---|
| 15 | layout 'pattern', {
|
---|
[31393] | 16 | artifact "[artifact]-[revision].jar"
|
---|
[31784] | 17 | artifact "[artifact]-snapshot-[revision].jar"
|
---|
| 18 | artifact "Archiv/[artifact]-snapshot-[revision].jar"
|
---|
[31393] | 19 | }
|
---|
| 20 | }
|
---|
[31784] | 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 | }
|
---|
[31393] | 28 | }
|
---|
| 29 | dependencies {
|
---|
[31784] | 30 | // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
|
---|
[31806] | 31 | // When using a numeric version number you can leave out {changing=true}.
|
---|
| 32 | compile(':josm:latest'){changing=true}
|
---|
[31784] | 33 | // For plugins it's irrelevant, which version is specified, always the latest version is used.
|
---|
[31806] | 34 | compile (':apache-commons:latest'){changing=true}
|
---|
| 35 | compile (':apache-http:latest'){changing=true}
|
---|
[31393] | 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 |
|
---|
[31798] | 63 | eclipse {
|
---|
| 64 | project {
|
---|
| 65 | name = 'JOSM-Mapillary'
|
---|
| 66 | natures 'org.sonarlint.eclipse.core.sonarlintNature'
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[31393] | 70 | build.dependsOn jacocoTestReport
|
---|
| 71 | build.dependsOn projectReport
|
---|
| 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 | manifest {
|
---|
[31783] | 107 | attributes("Plugin-Mainversion": project.property('plugin.main.version'),
|
---|
[31803] | 108 | "Plugin-Version": "31802",
|
---|
[31783] | 109 | "Plugin-Class": project.property('plugin.class'),
|
---|
| 110 | "Plugin-Description": project.property('plugin.description'),
|
---|
[31393] | 111 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
---|
[31783] | 112 | "Author": project.property('plugin.author'),
|
---|
| 113 | "Plugin-Link": project.property('plugin.link'),
|
---|
| 114 | "Plugin-Icon": project.property("plugin.icon"),
|
---|
| 115 | "Plugin-Requires": project.property("plugin.requires"),
|
---|
| 116 | "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime'))
|
---|
[31393] | 117 | }
|
---|
| 118 | }
|
---|
| 119 |
|
---|
[31784] | 120 | task activatePlugin(type: Copy) {
|
---|
| 121 | from "gradle/josm-preferences.xml"
|
---|
| 122 | into "$buildDir/.josm"
|
---|
| 123 | rename 'josm-preferences.xml', 'preferences.xml'
|
---|
[31393] | 124 | }
|
---|
| 125 |
|
---|
[31784] | 126 | task installPlugin(type: Copy) {
|
---|
| 127 | from "$buildDir/libs/${project.name}.jar"
|
---|
| 128 | from configurations.runtime
|
---|
| 129 | into "$buildDir/.josm/plugins"
|
---|
| 130 | include 'apache*.jar'
|
---|
| 131 | include "${project.name}.jar"
|
---|
| 132 | rename "${project.name}.jar", 'Mapillary.jar'
|
---|
| 133 | rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
|
---|
[31393] | 134 | }
|
---|
[31784] | 135 | installPlugin.dependsOn jar
|
---|
| 136 | installPlugin.dependsOn activatePlugin
|
---|
[31393] | 137 |
|
---|
[31784] | 138 | /**
|
---|
| 139 | * This runs the JOSM-version specified in the dependency configuration above.
|
---|
| 140 | * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
|
---|
| 141 | */
|
---|
| 142 | task runJosm(type: JavaExec) {
|
---|
| 143 | classpath = sourceSets.main.runtimeClasspath
|
---|
| 144 | main = 'JOSM'
|
---|
| 145 | args '--offline=josm_website'
|
---|
| 146 | jvmArgs "-Djosm.home=$buildDir/.josm"
|
---|
[31393] | 147 | }
|
---|
[31784] | 148 | runJosm.dependsOn installPlugin
|
---|