forked from ssadedin/bpipe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
executable file
·214 lines (163 loc) · 6.78 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
plugins {
id 'com.github.johnrengelman.shadow' version '4.0.2'
}
apply plugin: 'eclipse'
apply plugin: 'groovy'
project.ext {
VERSION="0.9.9.8"
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')) {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.8'
}
else {
compile files(fileTree(dir:'groovy-lib', includes:['*.jar']))
}
compile files(fileTree(dir:'local-lib', includes:['*.jar']))
compile 'org.codehaus.gpars:gpars:1.2.1'
// ivy allows Grape to be used inside Bpipe pipelines
compile group: 'org.apache.ivy', name: 'ivy', version: '2.4.0'
// In case GridGain ever revive their Maven repo ...
// compile ('org.gridgain:gridgain:4.0.2c') { transitive = false }
compile ('javax.mail:mail:1.4.5')
// Batik
compile 'org.apache.xmlgraphics:batik-util:1.7@jar'
compile 'org.apache.xmlgraphics:batik-css:1.7@jar'
compile 'org.apache.xmlgraphics:batik-dom:1.7'
compile 'org.apache.xmlgraphics:batik-svg-dom:1.7@jar'
compile 'org.apache.xmlgraphics:batik-svggen:1.7@jar'
compile 'org.apache.xmlgraphics:batik-awt-util:1.7@jar'
compile group: 'org.fusesource.jansi', name: 'jansi', version: '1.16'
compile group: 'org.apache.activemq', name: 'activemq-client', version: '5.14.5'
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.25.1'
compile group: 'com.fasterxml.jackson.jaxrs', name: 'jackson-jaxrs-json-provider', version: '2.9.1'
compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.0' // needed for gitlab4j
compile(group: 'org.gitlab4j', name: 'gitlab4j-api', version: '4.7.17') { transitive = false } // note 4.8 not compatible with jdk1.7
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.0'
compile group: 'org.json', name: 'json', version: '20180813'
compile ('com.hazelcast:hazelcast-all:2.1.2') { transitive = false }
cloudJar group: 'com.google.cloud', name: 'google-cloud-nio', version: '0.62.0-alpha'
cloudJar group: 'com.amazonaws', name: 'aws-java-sdk-ec2', version: '1.11.535'
cloudJar group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.535'
cloudJar group: 'com.upplication', name: 's3fs', version: '2.2.2'
testCompile 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'
} } }
}
jar {
def cloudJars = configurations.cloudJar*.name
def coreJars = configurations.compile*.name
def cloudOnly = cloudJars - coreJars
// println "The cloud exclusive jars are: " + cloudOnly.join(',') + "\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 "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('org/slf4j')
}
}
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
task cloudjar(type:ShadowJar) {
archiveName='bpipe-cloud.jar'
classifier='all'
configurations = [project.configurations.cloudJar]
mergeServiceFiles()
}
task stage(dependsOn: [jar,cloudjar]) {
doLast {
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: "**")
}
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.copy(todir: "$STAGE/lib/slf4j") {
ant.fileset(dir: 'local-lib/slf4j', includes: "slf4j-jdk14*.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")
}
}
}
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")
}
ant.gzip(destfile:"build/bpipe-${VERSION}.tar.gz", src: "build/bpipe-${VERSION}.tar")
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.3.1'
}