| 1 | apply plugin: 'eclipse'
|
|---|
| 2 | apply plugin: 'findbugs'
|
|---|
| 3 | apply plugin: 'idea'
|
|---|
| 4 | apply plugin: 'jacoco'
|
|---|
| 5 | apply plugin: 'java'
|
|---|
| 6 | apply plugin: 'pmd'
|
|---|
| 7 |
|
|---|
| 8 | sourceCompatibility = '1.7'
|
|---|
| 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:10485')
|
|---|
| 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 'LICENSE*'
|
|---|
| 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', 'org.eclipse.buildship.core.gradleprojectnature'
|
|---|
| 70 | buildCommand 'org.sonarlint.eclipse.core.sonarlintBuilder'
|
|---|
| 71 | buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
|
|---|
| 72 | buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|
| 75 | eclipseClasspath.dependsOn cleanEclipseClasspath
|
|---|
| 76 | eclipseProject.dependsOn cleanEclipseProject
|
|---|
| 77 | tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
|
|---|
| 78 |
|
|---|
| 79 | pmd {
|
|---|
| 80 | toolVersion project.property('tools.pmd.version')
|
|---|
| 81 | ignoreFailures true
|
|---|
| 82 | targetJdk 1.7 // 1.8 is not yet available (as of Gradle 2.14, see https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/quality/TargetJdk.html)
|
|---|
| 83 | ruleSetConfig = resources.text.fromFile('.settings/pmd-ruleset.xml')
|
|---|
| 84 | }
|
|---|
| 85 |
|
|---|
| 86 | build.dependsOn jacocoTestReport
|
|---|
| 87 |
|
|---|
| 88 | tasks.withType(Javadoc) {
|
|---|
| 89 | failOnError false
|
|---|
| 90 | }
|
|---|
| 91 |
|
|---|
| 92 | /** FindBugs configuration */
|
|---|
| 93 | findbugs {
|
|---|
| 94 | toolVersion = project.property('tools.findbugs.version')
|
|---|
| 95 | ignoreFailures = true
|
|---|
| 96 | effort = "max"
|
|---|
| 97 | reportLevel = "low"
|
|---|
| 98 | }
|
|---|
| 99 | tasks.withType(FindBugs) {
|
|---|
| 100 | reports {
|
|---|
| 101 | xml.enabled = false
|
|---|
| 102 | html.enabled = true
|
|---|
| 103 | }
|
|---|
| 104 | }
|
|---|
| 105 |
|
|---|
| 106 | /** JaCoCo configuration */
|
|---|
| 107 | jacoco {
|
|---|
| 108 | toolVersion = project.property('tools.jacoco.version')
|
|---|
| 109 | }
|
|---|
| 110 | jacocoTestReport {
|
|---|
| 111 | reports {
|
|---|
| 112 | xml.enabled true
|
|---|
| 113 | html.destination "$buildDir/reports/jacoco"
|
|---|
| 114 | }
|
|---|
| 115 | }
|
|---|
| 116 |
|
|---|
| 117 | test {
|
|---|
| 118 | testLogging {
|
|---|
| 119 | exceptionFormat "full"
|
|---|
| 120 | events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|---|
| 121 | }
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | jar {
|
|---|
| 125 | manifest {
|
|---|
| 126 | attributes(
|
|---|
| 127 | "Gradle-Version": project.getGradle().getGradleVersion(),
|
|---|
| 128 | "Created-By": System.getProperty("java.version")+" ("+System.getProperty("java.vendor")+")",
|
|---|
| 129 | "Plugin-Mainversion": project.property('plugin.main.version'),
|
|---|
| 130 | "Plugin-Version": project.property('plugin.svnrevision'),
|
|---|
| 131 | "Plugin-SemVersion": project.property('plugin.version'),
|
|---|
| 132 | "Plugin-Class": project.property('plugin.class'),
|
|---|
| 133 | "Plugin-Description": project.property('plugin.description'),
|
|---|
| 134 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
|---|
| 135 | "Author": project.property('plugin.author'),
|
|---|
| 136 | "Plugin-Link": project.property('plugin.link'),
|
|---|
| 137 | "Plugin-Icon": project.property("plugin.icon"),
|
|---|
| 138 | "Plugin-Requires": project.property("plugin.requires"),
|
|---|
| 139 | "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime')
|
|---|
| 140 | )
|
|---|
| 141 | }
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | task activatePlugin(type: Copy) {
|
|---|
| 145 | if (!new File("$buildDir/.josm/preferences.xml").exists()) {
|
|---|
| 146 | from "gradle/josm-preferences.xml"
|
|---|
| 147 | into "$buildDir/.josm"
|
|---|
| 148 | rename 'josm-preferences.xml', 'preferences.xml'
|
|---|
| 149 | }
|
|---|
| 150 | }
|
|---|
| 151 |
|
|---|
| 152 | task installPlugin(type: Copy) {
|
|---|
| 153 | from "$buildDir/libs/${project.name}.jar"
|
|---|
| 154 | from configurations.runtime
|
|---|
| 155 | into "$buildDir/.josm/plugins"
|
|---|
| 156 | include 'apache*.jar'
|
|---|
| 157 | include "${project.name}.jar"
|
|---|
| 158 | rename "${project.name}.jar", 'Mapillary.jar'
|
|---|
| 159 | rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
|
|---|
| 160 | }
|
|---|
| 161 | installPlugin.dependsOn jar
|
|---|
| 162 | installPlugin.dependsOn activatePlugin
|
|---|
| 163 |
|
|---|
| 164 | /**
|
|---|
| 165 | * This runs the JOSM-version specified in the dependency configuration above.
|
|---|
| 166 | * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
|
|---|
| 167 | */
|
|---|
| 168 | task runJosm(type: JavaExec) {
|
|---|
| 169 | classpath = sourceSets.main.runtimeClasspath
|
|---|
| 170 | main = 'JOSM'
|
|---|
| 171 | args '--offline=josm_website'
|
|---|
| 172 | jvmArgs "-Djosm.home=$buildDir/.josm"
|
|---|
| 173 | }
|
|---|
| 174 | runJosm.dependsOn installPlugin
|
|---|
| 175 |
|
|---|
| 176 |
|
|---|
| 177 | task debugJosm(type: JavaExec) {
|
|---|
| 178 | classpath = sourceSets.main.runtimeClasspath
|
|---|
| 179 | main = 'JOSM'
|
|---|
| 180 | args '--offline=josm_website'
|
|---|
| 181 | jvmArgs "-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006", "-Djosm.home=$buildDir/.josm"
|
|---|
| 182 | }
|
|---|
| 183 | debugJosm.dependsOn installPlugin
|
|---|