forked from halestudio/hale-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
349 lines (289 loc) · 11.7 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.standardout:gradle-eclipseconfig:1.0.0'
}
}
plugins {
id 'groovy'
id 'application'
id 'maven'
id 'osgi'
id 'com.bmuschko.docker-java-application' version '3.6.2'
id "nebula.ospackage-application" version "3.6.1"
id 'org.ajoberstar.grgit' version '1.5.0'
}
apply plugin: 'org.standardout.eclipseconfig'
sourceCompatibility = '1.8'
group = 'to.wetransform'
project.ext {
haleVersion = '4.1.0-SNAPSHOT'
}
version = '4.1.0-SNAPSHOT'
/*
* Dependencies
*/
repositories {
// mavenLocal() //XXX for testing
maven { // wetransform release repository (HALE releases and Eclipse dependencies)
url 'https://artifactory.wetransform.to/artifactory/libs-release-local'
}
maven { // wetransform snapshot repository (HALE snapshots)
url 'https://artifactory.wetransform.to/artifactory/libs-snapshot-local'
}
// this needs to be defined before jcenter/MavenCentral for retrieving JAI
maven {
url 'https://repo.osgeo.org/repository/release/'
}
maven { // HALE artifactory (dependencies for HALE)
url 'https://artifactory.wetransform.to/artifactory/ext-release-local'
}
jcenter()
}
configurations {
// exclude Saxon9 custom dependency by schema-utils (schematron validation)
compile.exclude group: 'org.opengis.cite.saxon', module: 'saxon9'
}
dependencies {
// HALE
// CLI API, utilities and default commands
compile "eu.esdihumboldt.hale:eu.esdihumboldt.util.cli:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.cli:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.cli.commands:$haleVersion"
// core
compile 'eu.esdihumboldt.unpuzzled:org.eclipse.equinox.nonosgi.registry:1.0.0'
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.core:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.groovy:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.align.merge:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.referencing:$haleVersion"
// transformation
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.transform:$haleVersion"
// needed to run successfully:
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.headless.orient:$haleVersion" // reiterable transformation sink (for WFS FeatureCollection)
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.propertyaccessor:$haleVersion" // for CQL filters to work
// transformation functions:
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.core:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.inspire:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.geometric:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.groovy.helpers:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.numeric:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.string:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.custom:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.cst.functions.collector:$haleVersion"
// formats
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xml:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xsd:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.gml:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.shp:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.csv:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.wfs:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.json:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.xls:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.geopackage:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.html.svg:$haleVersion"
// database support
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.postgresql:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.jdbc.mssql:$haleVersion"
// hale connect
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.haleconnect:$haleVersion"
// code list formats
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.codelist.xml:$haleVersion"
// Schematron validation
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.io.schematron:$haleVersion"
// replacement for omitted Saxon dependency
// tested w/ schematron validation in https://github.com/wetransform/exp-schematron/tree/exp/saxon-he
compile 'net.sf.saxon:Saxon-HE:9.7.0-20'
// converters
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.core:$haleVersion"
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.common.convert.wkt:$haleVersion"
// Groovy meta extensions
compile "eu.esdihumboldt.hale:eu.esdihumboldt.util.groovy.meta.extension:$haleVersion"
// logging
compile(group: 'eu.esdihumboldt.unpuzzled', name: 'de.fhg.igd.slf4jplus.logback.appender', version: '1.2.0.201503311443')
compile 'org.slf4j:jul-to-slf4j:1.7.21'
// resource cache
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource', version: haleVersion)
def resourcesVersion = '2018.8.7'
// OpenGIS schemas, INSPIRE schemas, W3C schemas, etc.
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.opengis.net', version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.inspire', version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.portele.de', version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.w3.org', version: resourcesVersion)
// INSPIRE code lists and feature concepts
compile(group: 'eu.esdihumboldt.hale',
name: 'eu.esdihumboldt.util.resource.codelists.inspire',
version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale',
name: 'eu.esdihumboldt.util.resource.codelists.inspire.accept-xml',
version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale',
name: 'eu.esdihumboldt.util.resource.featureconcepts.inspire',
version: resourcesVersion)
// More resources with different version
resourcesVersion = '2020.6.29'
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.adv-online.de', version: resourcesVersion)
compile(group: 'eu.esdihumboldt.hale', name: 'eu.esdihumboldt.util.resource.schemas.xplanung.de', version: resourcesVersion)
// user / customer specific
compile "eu.esdihumboldt.hale:eu.esdihumboldt.hale.adv.merge:$haleVersion"
// CLI
compile 'commons-cli:commons-cli:1.3.1'
// Groovy Shell
compile 'jline:jline:2.13'
// Testing
testCompile 'junit:junit:4.12'
testCompile 'com.github.stefanbirkner:system-rules:1.16.0'
}
configurations.all {
// ensure SNAPSHOTs are updated every time if needed
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
mainClassName = 'to.wetransform.halecli.CLI'
applicationName = 'hale'
applicationDefaultJvmArgs = [
'-Dcache.level1.enabled=false',
'-Dcache.level1.size=0',
'-Dcache.level2.enabled=false',
'-Dcache.level2.size=0'
]
/*
* plugin.xml and OSGi manifest
*
* For the plugin.xml file to be recognised there must be an
* OSGi manifest. In the resources is a dummy file that is required
* for tests and execution from within Eclipse or Gradle.
* In the build Jar, the manifest file is overriden.
*/
jar {
manifest {
symbolicName = 'to.wetransform.halecli;singleton:=true'
instruction 'Bundle-Vendor', 'wetransform GmbH'
}
}
/*
* OS packaging
*/
ospackage {
packageName = 'hale-cli'
link("/usr/local/bin/$applicationName", "/opt/$applicationName/bin/$applicationName")
link("/etc/bash_completion.d/hale", "/opt/$applicationName/etc/bash_completion.sh")
}
ospackage_application {
prefix = "/opt"
}
distributions {
main {
contents {
from(file('etc')) {
into 'etc'
}
}
}
}
/*
* Docker configuration
* see https://github.com/bmuschko/gradle-docker-plugin
*/
docker {
javaApplication {
baseImage = 'openjdk:8-jre-slim'
maintainer = 'Simon Templer "[email protected]"'
tag = "wetransform/${project.name}:${project.version}"
}
url = project.hasProperty('dockerHost') ? dockerHost : 'http://localdocker:2375'
registryCredentials {
url = 'https://index.docker.io/v1/'
username = project.hasProperty('dockerHubUsername') ? dockerHubUsername : ''
password = project.hasProperty('dockerHubPassword') ? dockerHubPassword : ''
email = project.hasProperty('dockerHubEmail') ? dockerHubEmail : ''
}
}
dockerPushImage {
// workaround for wrong image name used when pushing to docker hub
imageName = project.tasks.dockerBuildImage.getTag().split(':')[0]
tag = project.tasks.dockerBuildImage.getTag().split(':')[1]
}
dockerDistTar {
def buildTime = java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ISO_INSTANT);
label('git.sha': grgit.head().id, 'git.branch': grgit.branch.current.name, 'build.version': version, 'build.time': buildTime)
}
// "latest" tag
task dockerTagLatest(type: com.bmuschko.gradle.docker.tasks.image.DockerTagImage,
dependsOn: dockerBuildImage) {
imageId = "wetransform/${project.name}:${project.version}"
repository = "wetransform/${project.name}"
tag = 'latest'
}
task dockerPushLatest(type: com.bmuschko.gradle.docker.tasks.image.DockerPushImage,
dependsOn: dockerTagLatest) {
imageName = "wetransform/${project.name}"
tag = 'latest'
}
/*
* Packaging and publishing
*/
// package groovydoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'groovydoc') {
from groovydoc.destinationDir
classifier = 'javadoc'
}
// groovydoc task work-around
configurations {
jansi.extendsFrom(runtime)
}
groovydoc {
groovyClasspath = project.configurations.jansi
}
dependencies {
jansi 'org.fusesource.jansi:jansi:1.11'
}
// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
// define artifacts for upload
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
// exclude distZip ands distTar artifacts
configurations.archives.with {
artifacts.remove artifacts.find { it.archiveTask.is distZip }
artifacts.remove artifacts.find { it.archiveTask.is distTar }
}
uploadArchives {
repositories {
mavenDeployer {
// upload to wetransform artifactory
repository(url: 'https://artifactory.wetransform.to/artifactory/libs-release-local') {
authentication(userName: project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : '',
password: project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : '')
}
snapshotRepository(url: 'https://artifactory.wetransform.to/artifactory/libs-snapshot-local') {
authentication(userName: project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : '',
password: project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : '')
}
}
}
}
// Workaround for gradle application plugin 'the input line is too long' error on Windows
// see https://gist.github.com/jlmelville/2bfe9277e9e2c0ff79b6
tasks.withType(CreateStartScripts).each { task ->
task.doLast {
String text = task.windowsScript.text
text = text.replaceFirst(/(set CLASSPATH=%APP_HOME%\\lib\\).*/, { "${it[1]}*" })
task.windowsScript.write text
}
}
/*
* Gradle wrapper
*/
wrapper {
gradleVersion = '3.5'
}