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

Last change on this file since 31796 was 31784, checked in by floscher, 10 years ago

[mapillary] Declutter build.gradle, no longer needs JOSM installed in order to try plugin

When running ./gradlew runJosm, the latest JOSM-version is downloaded and run with JOSM_HOME set inside the build-directory, so it doesn't interfere with some other JOSM-installation.

File size: 3.5 KB
Line 
1apply plugin: 'eclipse'
2apply plugin: 'findbugs'
3apply plugin: 'jacoco'
4apply plugin: 'java'
5apply plugin: 'project-report'
6
7sourceCompatibility = '1.7'
8
9repositories {
10 // for JUnit
11 mavenCentral()
12 //for josm-(latest|tested).jar
13 ivy {
14 url 'https://josm.openstreetmap.de/download'
15 layout 'pattern', {
16 artifact "[artifact]-[revision].jar"
17 artifact "[artifact]-snapshot-[revision].jar"
18 artifact "Archiv/[artifact]-snapshot-[revision].jar"
19 }
20 }
21 //for josm-plugins
22 ivy {
23 url "https://svn.openstreetmap.org/applications/editors/josm/dist/"
24 layout "pattern", {
25 artifact "[artifact].jar"
26 }
27 }
28}
29dependencies {
30 // The JOSM-version can be specified as "latest", "tested" or the numeric version number.
31 compile ':josm:latest'
32 // For plugins it's irrelevant, which version is specified, always the latest version is used.
33 compile ':apache-commons:latest'
34 compile ':apache-http:latest'
35
36 testCompile 'junit:junit:4.12'
37}
38
39sourceSets {
40 main {
41 java {
42 srcDirs = ['src']
43 }
44 resources {
45 srcDirs = ["$projectDir"]
46 include 'data/**'
47 include 'images/**'
48 include 'README'
49 include 'GPL-v*.txt'
50 }
51 }
52 test {
53 java {
54 srcDirs = ['test/unit']
55 }
56 resources{
57 srcDirs = ['test/data']
58 }
59 }
60}
61
62build.dependsOn jacocoTestReport
63build.dependsOn projectReport
64
65/** FindBugs configuration */
66findbugs {
67 toolVersion = "3.0.1"
68 ignoreFailures = true
69 effort = "min"
70 reportLevel = "high"
71}
72tasks.withType(FindBugs) {
73 reports {
74 xml.enabled = false
75 html.enabled = true
76 }
77}
78
79/** JaCoCo configuration */
80jacoco {
81 toolVersion = "0.7.5.201505241946"
82}
83jacocoTestReport {
84 reports {
85 xml.enabled true
86 html.destination "$buildDir/reports/jacoco"
87 }
88}
89
90test {
91 testLogging {
92 exceptionFormat "full"
93 events "started", "passed", "skipped", "failed", "standardOut", "standardError"
94 }
95}
96
97jar {
98 manifest {
99 attributes("Plugin-Mainversion": project.property('plugin.main.version'),
100 "Plugin-Version": "31784",
101 "Plugin-Class": project.property('plugin.class'),
102 "Plugin-Description": project.property('plugin.description'),
103 "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
104 "Author": project.property('plugin.author'),
105 "Plugin-Link": project.property('plugin.link'),
106 "Plugin-Icon": project.property("plugin.icon"),
107 "Plugin-Requires": project.property("plugin.requires"),
108 "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime'))
109 }
110}
111
112task activatePlugin(type: Copy) {
113 from "gradle/josm-preferences.xml"
114 into "$buildDir/.josm"
115 rename 'josm-preferences.xml', 'preferences.xml'
116}
117
118task installPlugin(type: Copy) {
119 from "$buildDir/libs/${project.name}.jar"
120 from configurations.runtime
121 into "$buildDir/.josm/plugins"
122 include 'apache*.jar'
123 include "${project.name}.jar"
124 rename "${project.name}.jar", 'Mapillary.jar'
125 rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
126}
127installPlugin.dependsOn jar
128installPlugin.dependsOn activatePlugin
129
130/**
131 * This runs the JOSM-version specified in the dependency configuration above.
132 * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
133 */
134task runJosm(type: JavaExec) {
135 classpath = sourceSets.main.runtimeClasspath
136 main = 'JOSM'
137 args '--offline=josm_website'
138 jvmArgs "-Djosm.home=$buildDir/.josm"
139}
140runJosm.dependsOn installPlugin
Note: See TracBrowser for help on using the repository browser.