| 1 | apply plugin: 'eclipse'
|
|---|
| 2 | apply plugin: 'findbugs'
|
|---|
| 3 | apply plugin: 'jacoco'
|
|---|
| 4 | apply plugin: 'java'
|
|---|
| 5 | apply plugin: 'pmd'
|
|---|
| 6 | apply plugin: 'project-report'
|
|---|
| 7 |
|
|---|
| 8 | sourceCompatibility = '1.8'
|
|---|
| 9 |
|
|---|
| 10 | repositories {
|
|---|
| 11 | // for JUnit
|
|---|
| 12 | mavenCentral()
|
|---|
| 13 | //for josm-(latest|tested).jar
|
|---|
| 14 | ivy {
|
|---|
| 15 | url 'https://josm.openstreetmap.de/download'
|
|---|
| 16 | layout 'pattern', {
|
|---|
| 17 | artifact "[artifact]-[revision].jar"
|
|---|
| 18 | artifact "[artifact]-snapshot-[revision].jar"
|
|---|
| 19 | artifact "Archiv/[artifact]-snapshot-[revision].jar"
|
|---|
| 20 | }
|
|---|
| 21 | }
|
|---|
| 22 | //for josm-plugins
|
|---|
| 23 | ivy {
|
|---|
| 24 | url "https://svn.openstreetmap.org/applications/editors/josm/dist/"
|
|---|
| 25 | layout "pattern", {
|
|---|
| 26 | artifact "[artifact].jar"
|
|---|
| 27 | }
|
|---|
| 28 | }
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | dependencies {
|
|---|
| 32 | // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
|
|---|
| 33 | // When using a numeric version number you can leave out {changing=true}.
|
|---|
| 34 | compile(':josm:10327')
|
|---|
| 35 | // For plugins it's irrelevant, which version is specified, always the latest version is used.
|
|---|
| 36 | compile (name: 'apache-commons'){changing=true}
|
|---|
| 37 | compile (name: 'apache-http'){changing=true}
|
|---|
| 38 |
|
|---|
| 39 | testCompile 'junit:junit:4.12'
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | sourceSets {
|
|---|
| 43 | main {
|
|---|
| 44 | java {
|
|---|
| 45 | srcDirs = ['src']
|
|---|
| 46 | }
|
|---|
| 47 | resources {
|
|---|
| 48 | srcDirs = ["$projectDir"]
|
|---|
| 49 | include 'data/**'
|
|---|
| 50 | include 'images/**'
|
|---|
| 51 | include 'README'
|
|---|
| 52 | include 'GPL-v*.txt'
|
|---|
| 53 | }
|
|---|
| 54 | }
|
|---|
| 55 | test {
|
|---|
| 56 | java {
|
|---|
| 57 | srcDirs = ['test/unit']
|
|---|
| 58 | }
|
|---|
| 59 | resources{
|
|---|
| 60 | srcDirs = ['test/data']
|
|---|
| 61 | }
|
|---|
| 62 | }
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | eclipse {
|
|---|
| 66 | project {
|
|---|
| 67 | name = 'JOSM-Mapillary'
|
|---|
| 68 | comment = property('plugin.description')
|
|---|
| 69 | natures 'org.sonarlint.eclipse.core.sonarlintNature', 'ch.acanda.eclipse.pmd.builder.PMDNature'
|
|---|
| 70 | buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
|
|---|
| 71 | }
|
|---|
| 72 | }
|
|---|
| 73 | eclipseClasspath.dependsOn cleanEclipseClasspath
|
|---|
| 74 | eclipseProject.dependsOn cleanEclipseProject
|
|---|
| 75 | tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
|
|---|
| 76 |
|
|---|
| 77 | pmd {
|
|---|
| 78 | toolVersion project.property('tools.pmd.version')
|
|---|
| 79 | ignoreFailures true
|
|---|
| 80 | targetJdk 1.7 // 1.8 is not yet available
|
|---|
| 81 | ruleSetConfig = resources.text.fromFile('.settings/pmd-ruleset.xml')
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | build.dependsOn jacocoTestReport
|
|---|
| 85 | build.dependsOn projectReport
|
|---|
| 86 |
|
|---|
| 87 | tasks.withType(Javadoc) {
|
|---|
| 88 | failOnError false
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | /** FindBugs configuration */
|
|---|
| 92 | findbugs {
|
|---|
| 93 | toolVersion = project.property('tools.findbugs.version')
|
|---|
| 94 | ignoreFailures = true
|
|---|
| 95 | effort = "max"
|
|---|
| 96 | reportLevel = "low"
|
|---|
| 97 | }
|
|---|
| 98 | tasks.withType(FindBugs) {
|
|---|
| 99 | reports {
|
|---|
| 100 | xml.enabled = false
|
|---|
| 101 | html.enabled = true
|
|---|
| 102 | }
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | /** JaCoCo configuration */
|
|---|
| 106 | jacoco {
|
|---|
| 107 | toolVersion = project.property('tools.jacoco.version')
|
|---|
| 108 | }
|
|---|
| 109 | jacocoTestReport {
|
|---|
| 110 | reports {
|
|---|
| 111 | xml.enabled true
|
|---|
| 112 | html.destination "$buildDir/reports/jacoco"
|
|---|
| 113 | }
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | test {
|
|---|
| 117 | testLogging {
|
|---|
| 118 | exceptionFormat "full"
|
|---|
| 119 | events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|---|
| 120 | }
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | jar {
|
|---|
| 124 | manifest {
|
|---|
| 125 | attributes(
|
|---|
| 126 | "Gradle-Version": project.getGradle().getGradleVersion(),
|
|---|
| 127 | "Created-By": System.getProperty("java.version")+" ("+System.getProperty("java.vendor")+")",
|
|---|
| 128 | "Plugin-Mainversion": project.property('plugin.main.version'),
|
|---|
| 129 | "Plugin-Version": project.property('plugin.svnrevision'),
|
|---|
| 130 | "Plugin-SemVersion": project.property('plugin.version'),
|
|---|
| 131 | "Plugin-Class": project.property('plugin.class'),
|
|---|
| 132 | "Plugin-Description": project.property('plugin.description'),
|
|---|
| 133 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
|---|
| 134 | "Author": project.property('plugin.author'),
|
|---|
| 135 | "Plugin-Link": project.property('plugin.link'),
|
|---|
| 136 | "Plugin-Icon": project.property("plugin.icon"),
|
|---|
| 137 | "Plugin-Requires": project.property("plugin.requires"),
|
|---|
| 138 | "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime')
|
|---|
| 139 | )
|
|---|
| 140 | }
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | task activatePlugin(type: Copy) {
|
|---|
| 144 | if (!new File("$buildDir/.josm/preferences.xml").exists()) {
|
|---|
| 145 | from "gradle/josm-preferences.xml"
|
|---|
| 146 | into "$buildDir/.josm"
|
|---|
| 147 | rename 'josm-preferences.xml', 'preferences.xml'
|
|---|
| 148 | }
|
|---|
| 149 | }
|
|---|
| 150 |
|
|---|
| 151 | task installPlugin(type: Copy) {
|
|---|
| 152 | from "$buildDir/libs/${project.name}.jar"
|
|---|
| 153 | from configurations.runtime
|
|---|
| 154 | into "$buildDir/.josm/plugins"
|
|---|
| 155 | include 'apache*.jar'
|
|---|
| 156 | include "${project.name}.jar"
|
|---|
| 157 | rename "${project.name}.jar", 'Mapillary.jar'
|
|---|
| 158 | rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
|
|---|
| 159 | }
|
|---|
| 160 | installPlugin.dependsOn jar
|
|---|
| 161 | installPlugin.dependsOn activatePlugin
|
|---|
| 162 |
|
|---|
| 163 | /**
|
|---|
| 164 | * This runs the JOSM-version specified in the dependency configuration above.
|
|---|
| 165 | * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
|
|---|
| 166 | */
|
|---|
| 167 | task runJosm(type: JavaExec) {
|
|---|
| 168 | classpath = sourceSets.main.runtimeClasspath
|
|---|
| 169 | main = 'JOSM'
|
|---|
| 170 | args '--offline=josm_website'
|
|---|
| 171 | jvmArgs "-Djosm.home=$buildDir/.josm"
|
|---|
| 172 | }
|
|---|
| 173 | runJosm.dependsOn installPlugin
|
|---|