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

Last change on this file since 32329 was 32285, checked in by floscher, 9 years ago

Update several tools to their latest version

These are:

  • Java now uses source compatibility of 1.8 instead of 1.7 for compiling
  • Gradle 2.14
  • PMD 5.4.2
  • JaCoCo 0.7.7
File size: 4.6 KB
Line 
1apply plugin: 'eclipse'
2apply plugin: 'findbugs'
3apply plugin: 'jacoco'
4apply plugin: 'java'
5apply plugin: 'pmd'
6apply plugin: 'project-report'
7
8sourceCompatibility = '1.8'
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}
30
31dependencies {
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
42sourceSets {
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
65eclipse {
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}
73eclipseClasspath.dependsOn cleanEclipseClasspath
74eclipseProject.dependsOn cleanEclipseProject
75tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
76
77pmd {
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
84build.dependsOn jacocoTestReport
85build.dependsOn projectReport
86
87tasks.withType(Javadoc) {
88 failOnError false
89}
90
91/** FindBugs configuration */
92findbugs {
93 toolVersion = project.property('tools.findbugs.version')
94 ignoreFailures = true
95 effort = "max"
96 reportLevel = "low"
97}
98tasks.withType(FindBugs) {
99 reports {
100 xml.enabled = false
101 html.enabled = true
102 }
103}
104
105/** JaCoCo configuration */
106jacoco {
107 toolVersion = project.property('tools.jacoco.version')
108}
109jacocoTestReport {
110 reports {
111 xml.enabled true
112 html.destination "$buildDir/reports/jacoco"
113 }
114}
115
116test {
117 testLogging {
118 exceptionFormat "full"
119 events "started", "passed", "skipped", "failed", "standardOut", "standardError"
120 }
121}
122
123jar {
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
143task 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
151task 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}
160installPlugin.dependsOn jar
161installPlugin.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 */
167task runJosm(type: JavaExec) {
168 classpath = sourceSets.main.runtimeClasspath
169 main = 'JOSM'
170 args '--offline=josm_website'
171 jvmArgs "-Djosm.home=$buildDir/.josm"
172}
173runJosm.dependsOn installPlugin
Note: See TracBrowser for help on using the repository browser.