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