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

Last change on this file since 32473 was 32403, checked in by floscher, 10 years ago

Compile plugin with JOSM version >= plugin.main.version

Also add two previously missing file comments.

File size: 5.0 KB
RevLine 
[31393]1apply plugin: 'eclipse'
2apply plugin: 'findbugs'
[32340]3apply plugin: 'idea'
[31393]4apply plugin: 'jacoco'
5apply plugin: 'java'
[32063]6apply plugin: 'pmd'
[31393]7
[32378]8sourceCompatibility = '1.7'
[31393]9
10repositories {
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}
[32285]30
[31393]31dependencies {
[31784]32 // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
[31806]33 // When using a numeric version number you can leave out {changing=true}.
[32403]34 compile(':josm:10377')
[31784]35 // For plugins it's irrelevant, which version is specified, always the latest version is used.
[32070]36 compile (name: 'apache-commons'){changing=true}
37 compile (name: 'apache-http'){changing=true}
[31393]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
[31798]65eclipse {
66 project {
67 name = 'JOSM-Mapillary'
[32063]68 comment = property('plugin.description')
[32340]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'
[32063]71 buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
[32340]72 buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
[31798]73 }
74}
[32063]75eclipseClasspath.dependsOn cleanEclipseClasspath
76eclipseProject.dependsOn cleanEclipseProject
77tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
[31798]78
[32063]79pmd {
[32285]80 toolVersion project.property('tools.pmd.version')
[32063]81 ignoreFailures true
[32285]82 targetJdk 1.7 // 1.8 is not yet available
83 ruleSetConfig = resources.text.fromFile('.settings/pmd-ruleset.xml')
[32063]84}
85
[31393]86build.dependsOn jacocoTestReport
87
[31818]88tasks.withType(Javadoc) {
89 failOnError false
90}
91
[31393]92/** FindBugs configuration */
93findbugs {
[32285]94 toolVersion = project.property('tools.findbugs.version')
[31393]95 ignoreFailures = true
[32063]96 effort = "max"
97 reportLevel = "low"
[31393]98}
99tasks.withType(FindBugs) {
100 reports {
101 xml.enabled = false
102 html.enabled = true
103 }
104}
105
106/** JaCoCo configuration */
107jacoco {
[32285]108 toolVersion = project.property('tools.jacoco.version')
[31393]109}
110jacocoTestReport {
111 reports {
112 xml.enabled true
113 html.destination "$buildDir/reports/jacoco"
114 }
115}
116
117test {
118 testLogging {
119 exceptionFormat "full"
120 events "started", "passed", "skipped", "failed", "standardOut", "standardError"
121 }
122}
123
124jar {
125 manifest {
[31817]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'),
[31977]130 "Plugin-Version": project.property('plugin.svnrevision'),
131 "Plugin-SemVersion": project.property('plugin.version'),
[31817]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 )
[31393]141 }
142}
143
[31784]144task activatePlugin(type: Copy) {
[32078]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 }
[31393]150}
151
[31784]152task 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'
[31393]160}
[31784]161installPlugin.dependsOn jar
162installPlugin.dependsOn activatePlugin
[31393]163
[31784]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 */
168task runJosm(type: JavaExec) {
169 classpath = sourceSets.main.runtimeClasspath
170 main = 'JOSM'
171 args '--offline=josm_website'
172 jvmArgs "-Djosm.home=$buildDir/.josm"
[31393]173}
[31784]174runJosm.dependsOn installPlugin
[32381]175
176
177task 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}
184debugJosm.dependsOn installPlugin
Note: See TracBrowser for help on using the repository browser.