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