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 | tasks.withType(Javadoc) {
|
---|
74 | failOnError false
|
---|
75 | }
|
---|
76 |
|
---|
77 | /** FindBugs configuration */
|
---|
78 | findbugs {
|
---|
79 | toolVersion = "3.0.1"
|
---|
80 | ignoreFailures = true
|
---|
81 | effort = "min"
|
---|
82 | reportLevel = "high"
|
---|
83 | }
|
---|
84 | tasks.withType(FindBugs) {
|
---|
85 | reports {
|
---|
86 | xml.enabled = false
|
---|
87 | html.enabled = true
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | /** JaCoCo configuration */
|
---|
92 | jacoco {
|
---|
93 | toolVersion = "0.7.5.201505241946"
|
---|
94 | }
|
---|
95 | jacocoTestReport {
|
---|
96 | reports {
|
---|
97 | xml.enabled true
|
---|
98 | html.destination "$buildDir/reports/jacoco"
|
---|
99 | }
|
---|
100 | }
|
---|
101 |
|
---|
102 | test {
|
---|
103 | testLogging {
|
---|
104 | exceptionFormat "full"
|
---|
105 | events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
---|
106 | }
|
---|
107 | }
|
---|
108 |
|
---|
109 | jar {
|
---|
110 | manifest {
|
---|
111 | attributes(
|
---|
112 | "Gradle-Version": project.getGradle().getGradleVersion(),
|
---|
113 | "Created-By": System.getProperty("java.version")+" ("+System.getProperty("java.vendor")+")",
|
---|
114 | "Plugin-Mainversion": project.property('plugin.main.version'),
|
---|
115 | "Plugin-Version": "31817",
|
---|
116 | "Plugin-Class": project.property('plugin.class'),
|
---|
117 | "Plugin-Description": project.property('plugin.description'),
|
---|
118 | "Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
|
---|
119 | "Author": project.property('plugin.author'),
|
---|
120 | "Plugin-Link": project.property('plugin.link'),
|
---|
121 | "Plugin-Icon": project.property("plugin.icon"),
|
---|
122 | "Plugin-Requires": project.property("plugin.requires"),
|
---|
123 | "Plugin-Canloadatruntime": project.property('plugin.canloadatruntime')
|
---|
124 | )
|
---|
125 | }
|
---|
126 | }
|
---|
127 |
|
---|
128 | task activatePlugin(type: Copy) {
|
---|
129 | from "gradle/josm-preferences.xml"
|
---|
130 | into "$buildDir/.josm"
|
---|
131 | rename 'josm-preferences.xml', 'preferences.xml'
|
---|
132 | }
|
---|
133 |
|
---|
134 | task installPlugin(type: Copy) {
|
---|
135 | from "$buildDir/libs/${project.name}.jar"
|
---|
136 | from configurations.runtime
|
---|
137 | into "$buildDir/.josm/plugins"
|
---|
138 | include 'apache*.jar'
|
---|
139 | include "${project.name}.jar"
|
---|
140 | rename "${project.name}.jar", 'Mapillary.jar'
|
---|
141 | rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
|
---|
142 | }
|
---|
143 | installPlugin.dependsOn jar
|
---|
144 | installPlugin.dependsOn activatePlugin
|
---|
145 |
|
---|
146 | /**
|
---|
147 | * This runs the JOSM-version specified in the dependency configuration above.
|
---|
148 | * The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
|
---|
149 | */
|
---|
150 | task runJosm(type: JavaExec) {
|
---|
151 | classpath = sourceSets.main.runtimeClasspath
|
---|
152 | main = 'JOSM'
|
---|
153 | args '--offline=josm_website'
|
---|
154 | jvmArgs "-Djosm.home=$buildDir/.josm"
|
---|
155 | }
|
---|
156 | runJosm.dependsOn installPlugin
|
---|