forked from epam/NGB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
242 lines (205 loc) · 5.93 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
group "com.epam"
def uiFilesDestination = "$rootDir/server/catgenome/src/main/resources/static"
def serverBuilds = "$rootDir/server/catgenome/build/libs"
def cliBuilds = "$rootDir/server/ngb-cli/build/distributions"
def distDir = "$rootDir/dist"
def dockerDir = "$rootDir/docker/core"
def runTests = !hasProperty("noTest")
def database = hasProperty("database") ? database : "h2"
def buildNumber = hasProperty("buildNumber") ? buildNumber : ""
def profile = hasProperty("profile") ? profile : "release"
allprojects {
version = new Version(major: 2, minor: 5, patch: 0, build: buildNumber)
task printVersion {
doFirst {
println "Project version is $version"
}
}
}
class Version {
int major, minor, patch
String build
String toString() {
"$major.$minor.$patch${build ? ".$build" : ''}"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}
task ui(type: Copy) {
dependsOn ':client:buildUI'
doFirst {
delete fileTree(uiFilesDestination) {
exclude 'swagger-ui/**'
}
}
from "$rootDir/client/dist"
into uiFilesDestination
}
task buildWar(type: GradleBuild) {
dependsOn ui
if (runTests) {
tasks = ['clean', 'build']
} else {
tasks = ['clean', 'assemble']
}
startParameter.projectProperties = [profile : profile,
database : database,
buildNumber: buildNumber]
buildFile = "$rootDir/server/catgenome/build.gradle"
dir = "$rootDir/server/catgenome"
doLast {
copy {
from "$serverBuilds/catgenome.war"
into distDir
}
}
}
task buildJar(type: GradleBuild) {
dependsOn ui
if (runTests) {
tasks = ['clean', 'build']
} else {
tasks = ['clean', 'bootRepackage']
}
startParameter.projectProperties = [profile : 'jar',
database : database,
buildNumber: buildNumber]
buildFile = "$rootDir/server/catgenome/build.gradle"
dir = "$rootDir/server/catgenome"
doLast {
copy {
from "$serverBuilds/catgenome.jar"
into distDir
}
}
}
task buildCli(type: GradleBuild) {
if (runTests) {
tasks = ['clean', 'build']
} else {
tasks = ['clean', 'assemble']
}
buildFile = "$rootDir/server/ngb-cli/build.gradle"
dir = "$rootDir/ngb-cli/catgenome"
doLast {
copy {
from "$cliBuilds/ngb-cli.tar"
into distDir
}
}
}
apply from: "e2e/cli/cli-tests.gradle"
task integrationCliTest() {
doLast {e2eCliTests()}
}
task runMkdocs(type: Exec) {
doFirst {
delete fileTree("$rootDir/docs/site")
delete fileTree(dir: "$rootDir/docs", include: '**/ngb_docs_*')
}
commandLine "mkdocs", "build"
workingDir = "$rootDir/docs"
}
task buildDoc(type: Tar) {
dependsOn runMkdocs
from("$rootDir/docs/site") {
}
archiveName = "ngb-docs.tgz"
destinationDir file(distDir)
extension = 'tgz'
compression = Compression.GZIP
}
task buildDocker(type: Exec) {
dependsOn buildWar, buildCli
doFirst {
delete file("$dockerDir/ngb-cli.tar")
delete file("$dockerDir/catgenome.war")
copy {
from "$distDir/catgenome.war"
into dockerDir
}
copy {
from "$distDir/ngb-cli.tar"
into dockerDir
}
}
commandLine "docker", "build", "-t", "ngb:latest", "."
workingDir = "$rootDir/docker/core"
doLast {
delete file("$dockerDir/ngb-cli.tar")
delete file("$dockerDir/catgenome.war")
}
}
task buildDesktopUI(type: GradleBuild) {
doFirst {
delete fileTree(uiFilesDestination) {
exclude 'swagger-ui/**'
}
}
tasks = ['buildUI']
buildFile = "$rootDir/client/build.gradle"
dir = "$rootDir/client"
startParameter.projectProperties = [desktop : ""]
doLast {
copy {
from "$rootDir/client/dist"
into uiFilesDestination
}
}
}
task buildDesktopJar(type: GradleBuild) {
dependsOn buildDesktopUI
doFirst {
delete fileTree("$rootDir/desktop/lib/logs")
delete file("$rootDir/desktop/lib/catgenome.jar")
}
if (runTests) {
tasks = ['clean', 'build']
} else {
tasks = ['clean', 'bootRepackage']
}
startParameter.projectProperties = [profile : 'jar',
database : database,
buildNumber: buildNumber]
buildFile = "$rootDir/server/catgenome/build.gradle"
dir = "$rootDir/server/catgenome"
doLast {
copy {
from "$serverBuilds/catgenome.jar"
into "$rootDir/desktop/lib"
}
}
}
task buildDesktop(type: GradleBuild) {
dependsOn buildDesktopJar
doFirst {
delete file ("$rootDir/dist/ngb-linux-x64")
delete file ("$rootDir/dist/ngb-darwin-x64")
delete file ("$rootDir/dist/ngb-win32-x64")
delete file ("$rootDir/desktop/dist")
}
tasks = ['buildWrapper']
buildFile = "$rootDir/desktop/build.gradle"
dir = "$rootDir/desktop"
doLast {
copy {
from "$rootDir/desktop/dist"
into distDir
}
delete file("$rootDir/desktop/dist")
}
}
task buildAll(type: GradleBuild) {
tasks = ['buildWar', 'buildCli', 'buildJar', 'buildDoc', 'buildDocker', 'buildDesktop']
buildFile = "$rootDir/build.gradle"
dir = "$rootDir"
if (runTests) {
startParameter.projectProperties = [database : database,
buildNumber: buildNumber]
} else {
startParameter.projectProperties = [database : database,
buildNumber: buildNumber,
noTest: '']
}
}