-
Notifications
You must be signed in to change notification settings - Fork 57
/
build.gradle
executable file
·324 lines (250 loc) · 10.4 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
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
}
apply plugin: 'eclipse'
apply plugin: 'groovy'
project.ext {
VERSION="0.9.13"
STAGE="build/stage/bpipe-$VERSION"
}
sourceSets {
main {
groovy {
srcDirs = ['src']
}
}
test {
groovy {
srcDirs = ['test-src']
}
}
}
/*
configurations {
compile
cloudJar
}
*/
repositories {
flatDir(dirs: file('local-lib'))
mavenCentral()
// Unfortunately it seems GridGain have disabled their maven repository
// Therefore users need to now manually download the GridGain jar file
// maven { url "http://www.gridgainsystems.com/maven2" }
}
dependencies {
println "*" * 100
println "* " + "Building for Groovy $GROOVY_VERSION".center(96) + "* "
println "*" * 100
if(GROOVY_VERSION.startsWith('2.4')) {
// Grab the groovy-all jar which contains everything
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.8'
// Override with json from 2.5.6 because we want new features from the json
// module to allow json customisation
implementation files(fileTree(dir:'groovy-lib', includes:['groovy-json-2.5.13.jar']))
}
else {
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: GROOVY_VERSION
implementation group: 'org.codehaus.groovy', name: 'groovy-dateutil', version: GROOVY_VERSION
implementation group: 'org.codehaus.groovy', name: 'groovy-cli-commons', version: GROOVY_VERSION
implementation group: 'org.codehaus.groovy', name: 'groovy-datetime', version: GROOVY_VERSION
implementation group: 'org.codehaus.groovy', name: 'groovy-json', version: GROOVY_VERSION
implementation group: 'org.codehaus.groovy', name: 'groovy-sql', version: GROOVY_VERSION
}
implementation files(fileTree(dir:'local-lib', includes:['*.jar']))
implementation 'org.codehaus.gpars:gpars:1.2.1'
// ivy allows Grape to be used inside Bpipe pipelines
implementation group: 'org.apache.ivy', name: 'ivy', version: '2.4.0'
// In case GridGain ever revive their Maven repo ...
// implementation ('org.gridgain:gridgain:4.0.2c') { transitive = false }
implementation ('javax.mail:mail:1.4.5')
// Batik
implementation 'org.apache.xmlgraphics:batik-util:1.7@jar'
implementation 'org.apache.xmlgraphics:batik-css:1.7@jar'
implementation 'org.apache.xmlgraphics:batik-dom:1.7'
implementation 'org.apache.xmlgraphics:batik-svg-dom:1.7@jar'
implementation 'org.apache.xmlgraphics:batik-svggen:1.7@jar'
implementation 'org.apache.xmlgraphics:batik-awt-util:1.7@jar'
implementation group: 'org.fusesource.jansi', name: 'jansi', version: '1.16'
implementation group: 'org.apache.activemq', name: 'activemq-client', version: '5.14.5'
implementation group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.25.1'
implementation group: 'org.glassfish.jersey.media', name: 'jersey-media-multipart', version: '2.25.1'
implementation group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.13.1'
implementation(group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.14.30') { transitive = false }
implementation group: 'org.json', name: 'json', version: '20180813'
implementation group: 'jline', name: 'jline', version: '2.14.6'
implementation ('com.hazelcast:hazelcast-all:2.1.2') { transitive = false }
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '4.9.3'
implementation group: 'com.google.cloud', name: 'google-cloud-nio', version: '0.62.0-alpha'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-ec2', version: '1.12.25'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.12.25'
implementation 'com.amazonaws:aws-java-sdk-sqs:1.12.25'
implementation 'com.amazonaws:amazon-sqs-java-messaging-lib:1.1.2'
implementation group: 'com.upplication', name: 's3fs', version: '2.2.2'
implementation group: 'org.apache.tika', name: 'tika-core', version: '2.4.1'
// testImplementation group: 'junit', name: 'junit', version: '4.8.2'
}
//compileGroovy {
// classpath = (configurations.compile + configurations.cloudJar)
//}
// Check for presence of GridGain library - if not available, exclude the
// source files that depend on it
if(!new File("local-lib").listFiles().find { it.name =~ /gridgain.*.jar/ }) {
println ""
println "=" * 80
println "No Gridgain library found. Gridgain support disabled in this build.".center(80)
println "=" * 80
println ""
sourceSets { main { groovy {
srcDir 'src'
exclude '**/Gridgain*.groovy'
} } }
}
import com.github.jengelman.gradle.plugins.shadow.transformers.*
@groovy.transform.CompileStatic
@CacheableTransformer
class FixedGroovyExtensionModuleTransformer extends GroovyExtensionModuleTransformer {
private static final String GROOVY_EXTENSION_MODULE_DESCRIPTOR_PATH =
"META-INF/groovy/org.codehaus.groovy.runtime.ExtensionModule"
private final Properties module = new Properties()
@Override
boolean canTransformResource(FileTreeElement element) {
return element.relativePath.pathString == GROOVY_EXTENSION_MODULE_DESCRIPTOR_PATH
}
private handle(String key, String value, Closure mergeValue) {
def existingValue = module.getProperty(key)
if (existingValue) {
mergeValue(existingValue)
} else {
module.setProperty(key, value)
}
}
@Override
boolean hasTransformedResource() {
return module.size() > 0
}
@Override
void modifyOutputStream(shadow.org.apache.tools.zip.ZipOutputStream os, boolean preserveFileTimestamps) {
shadow.org.apache.tools.zip.ZipEntry entry = new shadow.org.apache.tools.zip.ZipEntry(GROOVY_EXTENSION_MODULE_DESCRIPTOR_PATH)
entry.time = TransformerContext.getEntryTimestamp(preserveFileTimestamps, entry.time)
os.putNextEntry(entry)
module.store(os, null)
os.closeEntry()
}
}
shadowJar {
transform(FixedGroovyExtensionModuleTransformer)
exclude '*slf4j-*'
// minimize {
// dependency('org.codehaus.groovy:.*:.*')
// }
}
/*
jar {
duplicatesStrategy 'include'
def cloudJars = configurations.cloudJar*.name
def coreJars = configurations.compile*.name
def cloudOnly = cloudJars - coreJars
println "The cloud exclusive jars are: \n\n" + configurations.cloudJar.grep { (it.name in cloudOnly) }.join('\n') + "\n"
from configurations.compile.grep {
!(it.name in cloudOnly) &&
!(it.name in ["mail.jar"]) &&
!it.name.startsWith("gridgain") &&
!it.name.startsWith("hazelcast") &&
!it.name.startsWith("xalan-") &&
!it.name.startsWith("xml-apis") &&
!it.name.startsWith("slf4j-jdk14")
}.collect {
// println it
// println "main: " + it.name
it.isDirectory() ? it : zipTree(it)
}
exclude { details ->
// details.relativePath.pathString.startsWith('javax/xml') ||
details.relativePath.pathString.startsWith('org/xml') // ||
// details.relativePath.pathString.startsWith('jersey') // ||
// details.relativePath.pathString.startsWith('org/slf4j')
}
// mergeGroovyExtensionModules()
}
*/
import java.nio.file.Files
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
//task cloudjar(type:ShadowJar) {
//
// archiveName='bpipe-cloud.jar'
//
// classifier='all'
//
// from configurations.cloudJar.each {
// println it
// }
//
//
// configurations = [project.configurations.cloudJar]
//
// mergeServiceFiles()
//}
task bpipeJar(type: Jar, dependsOn: 'compileGroovy') {
from 'build/classes/groovy/main'
archiveFileName='bpipe-only.jar'
duplicatesStrategy 'include'
}
task stage(dependsOn: [bpipeJar, shadowJar /*,cloudjar*/]) {
doLast {
println "The staging directory is $STAGE"
ant.mkdir(dir: STAGE)
ant.mkdir(dir: "$STAGE/bin")
ant.mkdir(dir: "$STAGE/lib")
ant.mkdir(dir: "$STAGE/lib/slf4j")
ant.copy(todir: "$STAGE/bin") {
ant.fileset(dir: 'bin', includes: "**")
}
println "The file to stage bpipe to is: " + (new File(STAGE+'/bin/bpipe')).absolutePath
new File(STAGE+'/bin/bpipe').text =
new File("bin/bpipe").text.replaceAll("VERSION=0.0.0","VERSION=$VERSION").replaceAll("BUILDDATE=0","BUILDDATE="+String.valueOf(System.currentTimeMillis()))
ant.copy(todir: "$STAGE/lib") {
// do not distribute mail.jar due to license
ant.fileset(dir: 'local-lib', includes: "*.jar",
excludes: "slf4j-*,mail.jar,gridgain-*.jar,hazelcast-*.jar,batik*.jar,commons-cli*.jar,jgraphx.jar,xml-*.jar,gpars*.jar,jsr*.jar,extra166y*.jar,groovy-all-*.jar,google-*.jar")
// ant.fileset(dir: 'build/libs', includes: "bpipe.jar,bpipe-cloud.jar")
ant.fileset(dir: 'build/libs', includes: "bpipe-all.jar")
}
ant.copy(todir: "$STAGE/lib/slf4j") {
ant.fileset(dir: 'local-lib/slf4j', includes: "*.jar")
}
["templates","html"].each { type ->
ant.mkdir(dir: "$STAGE/$type")
ant.copy(todir: "$STAGE/$type") {
ant.fileset(dir: "src/main/$type/bpipe", includes: "**")
}
}
ant.copy(todir: "$STAGE") {
ant.fileset(dir: 'src/main/config', includes: "bpipe.config")
}
ant.chmod(perm: 'a+rx') {
ant.fileset(dir: "$STAGE/bin", includes: "**")
}
}
}
task dist(dependsOn: stage) {
doLast {
ant.tar(destfile: "build/bpipe-${VERSION}.tar") {
ant.fileset(dir: "build/stage", includes: "bpipe-${VERSION}/lib/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipe-${VERSION}/bpipe.config", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipe-${VERSION}/html/**", excludes:"**/*.swp")
ant.fileset(dir: "build/stage", includes: "bpipe-${VERSION}/templates/**", excludes:"**/*.swp")
ant.tarfileset(dir: "build/stage", filemode:"755", includes: "bpipe-${VERSION}/bin/**", excludes:"**/*.swp")
}
// Note: natively zipping loses permissions, but repackaging tar does not
ant.zip(destfile: "build/bpipe-${VERSION}.zip") {
ant.tarfileset(src: "build/bpipe-${VERSION}.tar")
}
ant.gzip(destfile:"build/bpipe-${VERSION}.tar.gz", src: "build/bpipe-${VERSION}.tar")
}
}
wrapper {
gradleVersion = '5.2.1'
}