forked from JOSM/Mapillary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
184 lines (165 loc) · 5.02 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
apply plugin: 'eclipse'
apply plugin: 'findbugs'
apply plugin: 'idea'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'pmd'
sourceCompatibility = '1.7'
repositories {
// for JUnit
mavenCentral()
//for josm-(latest|tested).jar
ivy {
url 'https://josm.openstreetmap.de/download'
layout 'pattern', {
artifact "[artifact]-[revision].jar"
artifact "[artifact]-snapshot-[revision].jar"
artifact "Archiv/[artifact]-snapshot-[revision].jar"
}
}
//for josm-plugins
ivy {
url "https://svn.openstreetmap.org/applications/editors/josm/dist/"
layout "pattern", {
artifact "[artifact].jar"
}
}
}
dependencies {
// The JOSM-version can be specified as "latest", "tested" or the numeric version number.
// When using a numeric version number you can leave out {changing=true}.
compile(':josm:10377')
// For plugins it's irrelevant, which version is specified, always the latest version is used.
compile (name: 'apache-commons'){changing=true}
compile (name: 'apache-http'){changing=true}
testCompile 'junit:junit:4.12'
}
sourceSets {
main {
java {
srcDirs = ['src']
}
resources {
srcDirs = ["$projectDir"]
include 'data/**'
include 'images/**'
include 'README'
include 'GPL-v*.txt'
}
}
test {
java {
srcDirs = ['test/unit']
}
resources{
srcDirs = ['test/data']
}
}
}
eclipse {
project {
name = 'JOSM-Mapillary'
comment = property('plugin.description')
natures 'org.sonarlint.eclipse.core.sonarlintNature', 'ch.acanda.eclipse.pmd.builder.PMDNature', 'org.eclipse.buildship.core.gradleprojectnature'
buildCommand 'org.sonarlint.eclipse.core.sonarlintBuilder'
buildCommand 'ch.acanda.eclipse.pmd.builder.PMDBuilder'
buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
}
}
eclipseClasspath.dependsOn cleanEclipseClasspath
eclipseProject.dependsOn cleanEclipseProject
tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']
pmd {
toolVersion project.property('tools.pmd.version')
ignoreFailures true
targetJdk 1.7 // 1.8 is not yet available
ruleSetConfig = resources.text.fromFile('.settings/pmd-ruleset.xml')
}
build.dependsOn jacocoTestReport
tasks.withType(Javadoc) {
failOnError false
}
/** FindBugs configuration */
findbugs {
toolVersion = project.property('tools.findbugs.version')
ignoreFailures = true
effort = "max"
reportLevel = "low"
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
/** JaCoCo configuration */
jacoco {
toolVersion = project.property('tools.jacoco.version')
}
jacocoTestReport {
reports {
xml.enabled true
html.destination "$buildDir/reports/jacoco"
}
}
test {
testLogging {
exceptionFormat "full"
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
}
}
jar {
manifest {
attributes(
"Gradle-Version": project.getGradle().getGradleVersion(),
"Created-By": System.getProperty("java.version")+" ("+System.getProperty("java.vendor")+")",
"Plugin-Mainversion": project.property('plugin.main.version'),
"Plugin-Version": project.property('plugin.svnrevision'),
"Plugin-SemVersion": project.property('plugin.version'),
"Plugin-Class": project.property('plugin.class'),
"Plugin-Description": project.property('plugin.description'),
"Plugin-Date": String.format("%1\$tY-%1\$tm-%1\$tdT%1\$tH:%1\$tM:%1\$tS%1\$tz", new GregorianCalendar()),
"Author": project.property('plugin.author'),
"Plugin-Link": project.property('plugin.link'),
"Plugin-Icon": project.property("plugin.icon"),
"Plugin-Requires": project.property("plugin.requires"),
"Plugin-Canloadatruntime": project.property('plugin.canloadatruntime')
)
}
}
task activatePlugin(type: Copy) {
if (!new File("$buildDir/.josm/preferences.xml").exists()) {
from "gradle/josm-preferences.xml"
into "$buildDir/.josm"
rename 'josm-preferences.xml', 'preferences.xml'
}
}
task installPlugin(type: Copy) {
from "$buildDir/libs/${project.name}.jar"
from configurations.runtime
into "$buildDir/.josm/plugins"
include 'apache*.jar'
include "${project.name}.jar"
rename "${project.name}.jar", 'Mapillary.jar'
rename 'apache-(.*)-.*.jar', 'apache-$1.jar'
}
installPlugin.dependsOn jar
installPlugin.dependsOn activatePlugin
/**
* This runs the JOSM-version specified in the dependency configuration above.
* The home-directory of this JOSM is located in $buildDir/.josm, so it doesn't interfere with any other JOSM-installations.
*/
task runJosm(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'JOSM'
args '--offline=josm_website'
jvmArgs "-Djosm.home=$buildDir/.josm"
}
runJosm.dependsOn installPlugin
task debugJosm(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'JOSM'
args '--offline=josm_website'
jvmArgs "-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006", "-Djosm.home=$buildDir/.josm"
}
debugJosm.dependsOn installPlugin