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

Last change on this file since 32065 was 32063, checked in by floscher, 9 years ago

[mapillary] Analyze code with PMD in Eclipse and in Gradle builds

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