source: osm/applications/editors/josm/plugins/mapillary/build.gradle@ 32158

Last change on this file since 32158 was 32078, checked in by floscher, 9 years ago

[mapillary] Highlight the sequence that the selected image is contained in

  • this also fixes one unit test that failed since the last commit
  • and the JOSM-preferences are no longer overwritten everytime you run ./gradlew runJosm, only when you ./gradlew clean
File size: 4.5 KB
Line 
1apply plugin: 'eclipse'
2apply plugin: 'findbugs'
3apply plugin: 'jacoco'
4apply plugin: 'java'
5apply plugin: 'pmd'
6apply plugin: 'project-report'
7
8sourceCompatibility = '1.7'
9
10repositories {
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}
30dependencies {
31 // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
32 // When using a numeric version number you can leave out {changing=true}.
33 compile(':josm:9811')
34 // For plugins it's irrelevant, which version is specified, always the latest version is used.
35 compile (name: 'apache-commons'){changing=true}
36 compile (name: 'apache-http'){changing=true}
37
38 testCompile 'junit:junit:4.12'
39}
40
41sourceSets {
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
64eclipse {
65 project {
66 name = 'JOSM-Mapillary'
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'
70 }
71}
72eclipseClasspath.dependsOn cleanEclipseClasspath
73eclipseProject.dependsOn cleanEclipseProject
74tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
75
76pmd {
77 toolVersion '5.4.1'
78 ignoreFailures true
79 targetJdk sourceCompatibility
80 ruleSetFiles = files('.settings/pmd-ruleset.xml')
81}
82
83build.dependsOn jacocoTestReport
84build.dependsOn projectReport
85
86tasks.withType(Javadoc) {
87 failOnError false
88}
89
90/** FindBugs configuration */
91findbugs {
92 toolVersion = "3.0.1"
93 ignoreFailures = true
94 effort = "max"
95 reportLevel = "low"
96}
97tasks.withType(FindBugs) {
98 reports {
99 xml.enabled = false
100 html.enabled = true
101 }
102}
103
104/** JaCoCo configuration */
105jacoco {
106 toolVersion = "0.7.5.201505241946"
107}
108jacocoTestReport {
109 reports {
110 xml.enabled true
111 html.destination "$buildDir/reports/jacoco"
112 }
113}
114
115test {
116 testLogging {
117 exceptionFormat "full"
118 events "started", "passed", "skipped", "failed", "standardOut", "standardError"
119 }
120}
121
122jar {
123 manifest {
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'),
128 "Plugin-Version": project.property('plugin.svnrevision'),
129 "Plugin-SemVersion": project.property('plugin.version'),
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 )
139 }
140}
141
142task activatePlugin(type: Copy) {
143 if (!new File("$buildDir/.josm/preferences.xml").exists()) {
144 from "gradle/josm-preferences.xml"
145 into "$buildDir/.josm"
146 rename 'josm-preferences.xml', 'preferences.xml'
147 }
148}
149
150task installPlugin(type: Copy) {
151 from "$buildDir/libs/${project.name}.jar"
152 from configurations.runtime
153 into "$buildDir/.josm/plugins"
154 include 'apache*.jar'
155 include "${project.name}.jar"
156 rename "${project.name}.jar", 'Mapillary.jar'
157 rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
158}
159installPlugin.dependsOn jar
160installPlugin.dependsOn activatePlugin
161
162/**
163 * This runs the JOSM-version specified in the dependency configuration above.
164 * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
165 */
166task runJosm(type: JavaExec) {
167 classpath = sourceSets.main.runtimeClasspath
168 main = 'JOSM'
169 args '--offline=josm_website'
170 jvmArgs "-Djosm.home=$buildDir/.josm"
171}
172runJosm.dependsOn installPlugin
Note: See TracBrowser for help on using the repository browser.