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