-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
176 lines (150 loc) · 4.53 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
plugins {
id 'groovy'
id 'application'
id 'maven-publish'
id 'com.bmuschko.docker-java-application' version '9.3.1'
id 'com.diffplug.spotless' version '6.23.0'
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
group = 'to.wetransform.hale'
version = '5.1.0-SNAPSHOT'
repositories {
// mavenLocal() //XXX for testing
maven {
// wetransform release repository (hale releases and Eclipse dependencies)
url 'https://artifactory.wetransform.to/artifactory/local'
}
// this needs to be defined before jcenter/MavenCentral for retrieving JAI
maven {
url 'https://repo.osgeo.org/repository/release/'
}
mavenCentral()
}
project.ext {
haleVersion = '5.1.0-SNAPSHOT'
cliVersion = '5.1.0-SNAPSHOT'
groovyVersion = '2.5.19'
}
dependencies {
implementation 'eu.esdihumboldt.unpuzzled:org.eclipse.equinox.nonosgi.registry:1.0.0'
implementation "to.wetransform:hale-cli:$cliVersion", {
/*
* XXX The dependencies introduced by the schematron bundle cause some problems.
*/
exclude group: 'eu.esdihumboldt.hale', module: 'eu.esdihumboldt.hale.io.schematron'
}
implementation "eu.esdihumboldt.hale:eu.esdihumboldt.hale.app.cli.commands:$haleVersion"
implementation "org.codehaus.groovy:groovy-all:$groovyVersion"
implementation 'org.json:json:20190722'
implementation 'org.slf4j:jul-to-slf4j:1.7.21'
implementation 'org.apache.httpcomponents:httpmime:4.3.6'
// Testing
testImplementation 'junit:junit:4.12'
// Logging
testRuntimeOnly 'ch.qos.logback:logback-core:1.4.11'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.4.11'
}
configurations.all {
// ensure SNAPSHOTs are updated every time if needed
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
def defaultJvmArgs = [
'-Dcache.level1.enabled=false',
'-Dcache.level1.size=0',
'-Dcache.level2.enabled=false',
'-Dcache.level2.size=0',
'--add-exports=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED'
]
mainClassName = 'to.wetransform.hale.transformer.Launcher'
/*
* Docker configuration
* see https://github.com/bmuschko/gradle-docker-plugin
*/
docker {
javaApplication {
baseImage = 'eclipse-temurin:17-jre-jammy'
maintainer = 'wetransform GmbH "[email protected]"'
images = [
"wetransform/${project.name}:${project.version}",
"wetransform/${project.name}:latest"
]
// apply JAVA_OPTS to docker plugin as the default args configured in build does not apply to docker plugin
jvmArgs = defaultJvmArgs
}
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 : ''
}
}
dockerCreateDockerfile {
def buildTime = java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ISO_INSTANT);
label('build.version': version, 'build.time': buildTime)
}
task dockerTagLatest(dependsOn: dockerBuildImage) {}
task dockerPushLatest(dependsOn: dockerPushImage) {}
// package groovydoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'groovydoc') {
from groovydoc.destinationDir
archiveClassifier = 'javadoc'
}
// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
// define artifacts for upload
artifacts {
archives jar
archives packageJavadoc
archives packageSources
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact packageSources
artifact packageJavadoc
}
}
repositories {
maven {
url = project.version.endsWith('-SNAPSHOT') ?
'https://artifactory.wetransform.to/artifactory/libs-snapshot-local' :
'https://artifactory.wetransform.to/artifactory/libs-release-local'
credentials {
username project.hasProperty('wetfArtifactoryUser') ? wetfArtifactoryUser : ''
password project.hasProperty('wetfArtifactoryPassword') ? wetfArtifactoryPassword : ''
}
}
}
}
task uploadArchives {
dependsOn 'publish'
}
spotless {
groovy {
importOrder('groovy', 'java', 'javax', '')
removeSemicolons()
greclipse()
// excludes all Java sources within the Groovy source dirs from formatting
excludeJava()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target '*.gradle' // default target of groovyGradle
greclipse()
}
}
/*
* Gradle wrapper
*/
wrapper {
gradleVersion = '8.4'
}