forked from osmlab/josm-atlas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
188 lines (164 loc) · 4.45 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
185
186
187
buildscript {
dependencies {
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.4.0'
}
}
plugins {
id "de.undercouch.download" version "3.2.0"
// Used to promote a staging release build
// https://github.com/Codearte/gradle-nexus-staging-plugin
// gradle closeAndReleaseRepository
id "io.codearte.nexus-staging" version "0.8.0"
}
project.ext.pluginName = 'josm-atlas'
project.ext.josmVersion = '12484'
project.ext.josmMinVersion = '11714'
apply from: 'dependencies.gradle'
apply plugin: 'java'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: "com.diffplug.gradle.spotless"
apply plugin: 'idea'
sourceCompatibility=1.8
targetCompatibility=1.8
repositories
{
// For geotools
maven { url "http://download.osgeo.org/webdav/geotools/" }
mavenCentral()
}
idea {
project {
languageLevel = '1.8'
}
}
spotless {
java {
importOrder(['static java', 'static javax', 'static org', 'static com', 'static scala', 'java', 'javax', 'org', 'com', 'scala'])
removeUnusedImports()
eclipse().configFile 'config/format/code_format.xml'
}
}
// corresponds to POM description
description = "Atlas Library"
// This is to skip the tasks for which there is a skip<TaskName>=true environment variable
def skippedTaskNames = System.getenv().findAll { key, value ->
key.startsWith("skip") && value.equalsIgnoreCase("true")
}.keySet().collect { it.substring(4) }
gradle.startParameter.excludedTaskNames += skippedTaskNames
checkstyle
{
toolVersion = versions.checkstyle
}
test
{
testLogging
{
events "passed", "skipped", "failed"
}
}
configurations
{
all
{
resolutionStrategy
{
force packages.atlas
}
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}
}
dependencies
{
compile packages.atlas
compile files("lib/josm.jar")
}
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}
/**
* Artifact related items
*/
jar
{
from{
configurations.compile.collect
{
it.isDirectory() ? it : zipTree(it).matching{
exclude
{
it.path.contains('META-INF') && (it.path.endsWith('.SF') || it.path.endsWith('.DSA') || it.path.endsWith('.RSA'))
}
}
}
}
manifest
{
attributes("Author": "James Gage",
"Plugin-Class": "org.openstreetmap.atlas.AtlasReader",
"Plugin-Date": "2017-08-07T23:12:29.582966Z",
"Plugin-Description": "Allows you to view an Atlas file as a layer.",
"Plugin-Icon": "images/dialogs/world-3.png",
"Plugin-Link": "http://wiki.openstreetmap.org/index.php/JOSM/Plugins",
"Plugin-Mainversion": josmMinVersion,
"Plugin-Version": version,
"Plugin-Canloadatruntime": "true",
)
}
}
// Javadoc currently fails on a dependency issue
//task javadocJar(type: Jar) {
// classifier = 'javadoc'
// from javadoc
//}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts
{
archives /*javadocJar,*/ sourcesJar
}
/**
* JOSM SPECIFIC TASKS
*/
import de.undercouch.gradle.tasks.download.Download
import org.gradle.internal.os.OperatingSystem
/**
* This should only be run when we want to upgrade lib/josm.jar. This file does get committed,
* so maintainers only need to run this when we want to support a newer version of JOSM.
*
* Therefore, this is not a default task.
*/
task downloadJosm(type: Download) {
src 'http://josm.openstreetmap.de/download/josm-snapshot-' + josmVersion + '.jar'
dest 'lib/josm.jar'
}
/**
* This task installs the plugin in your system's JOSM plugins directory.
*
* https://josm.openstreetmap.de/wiki/Help/Preferences
*
* On macOS:
*
* ~/Library/JOSM/plugins/
*/
task installPlugin(type: Copy, dependsOn: jar) {
def destStr
if(OperatingSystem.current().isMacOsX()) {
destStr = "${System.getProperty('user.home')}/Library/JOSM/plugins"
} else if(OperatingSystem.current().isWindows()) {
destStr = "${System.getenv()['APPDATA']}/JOSM/plugins"
} else {
destStr = "${System.getProperty('user.home')}/.josm/plugins"
}
println("Plugin JAR Archive Path: " + jar.archivePath)
println("Plugin JAR Destination Path: " + destStr)
from jar.archivePath
into destStr
rename {
pluginName + '.jar'
}
}