forked from epam/cloud-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
198 lines (167 loc) · 6.01 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
group 'com.epam.pipeline'
def buildNumber = hasProperty("buildNumber") ? buildNumber : ""
def profile = hasProperty("profile") ? profile : ""
allprojects {
version = new Version(major: 0, minor: 17, patch: 0, build: buildNumber)
task printVersion {
doFirst {
println "Project version is $version"
}
}
apply plugin: "checkstyle"
apply plugin: "pmd"
pmd {
ruleSetFiles = files("$rootDir/config/pmd/pmd-ruleset.xml")
}
checkstyle {
toolVersion = "7.2"
}
}
class Version {
int major, minor, patch
String build
String toString() {
"$major.$minor.$patch${build ? ".$build" : ''}"
}
}
task cleanPipe(type: Delete) {
group = 'build'
delete "$project.rootDir/dist/pipe-common.tar.gz"
}
task buildPipe(type: Tar, dependsOn: cleanPipe) {
group = 'build'
from("$project.rootDir/workflows/pipe-common/")
baseName = 'pipe-common'
destinationDir = file("$project.rootDir/dist/")
extension = 'tar.gz'
compression = Compression.GZIP
doLast {
delete "$project.rootDir/api/src/main/resources/static/pipe-common.tar.gz"
copy {
from "$project.rootDir/dist/pipe-common.tar.gz"
into "$project.rootDir/api/src/main/resources/static/"
}
}
}
task runMkdocs(type: Exec) {
doFirst {
delete fileTree("$rootDir/docs/site")
}
commandLine "mkdocs", "build"
workingDir = "$rootDir/docs"
}
task buildDoc(type: Tar) {
dependsOn runMkdocs
from("$rootDir/docs/site") {
}
archiveName = "cloud-pipeline-docs.tar.gz"
destinationDir file("$rootDir/dist")
extension = 'tar.gz'
compression = Compression.GZIP
}
task buildAllFast(dependsOn: [":core:build", "client:buildUI", buildPipe, buildDoc,
":pipe-cli:build", ":pipe-cli:buildLinux", ":pipe-cli:buildWin", ":jwt-generator:shadowJar",
":api:bootRepackage", ":notifier:smtp:bootRepackage", ":docker-comp-scan:bootRepackage",
":elasticsearch-agent:bootJar", ":data-transfer-service:bootJar", ":vm-monitor:bootJar",
":data-sharing-service:buildFast", ":fs-browser:build", ":billing-report-agent:bootJar",
":cloud-pipeline-webdav-client:buildWin", ":cloud-pipeline-webdav-client:buildLinux"]) {
group = 'build'
}
task buildAll(dependsOn: [":core:build", "client:buildUI", buildPipe, buildDoc,
":pipe-cli:build", ":pipe-cli:buildLinux", ":pipe-cli:buildWin", ":jwt-generator:shadowJar",
":api:build", ":notifier:smtp:build", ":docker-comp-scan:build",
":elasticsearch-agent:build", ":data-transfer-service:build", ":vm-monitor:build",
":data-sharing-service:buildAll", ":fs-browser:build", ":billing-report-agent:build",
":cloud-pipeline-webdav-client:buildWin", ":cloud-pipeline-webdav-client:buildLinux"]) {
group = 'build'
}
task installDist() {
group = 'distribution'
if (project.hasProperty('fast')) {
dependsOn buildAllFast
} else {
dependsOn buildAll
}
doLast {
def distFolder = "$project.buildDir/install/bin"
mkdir(distFolder)
// copy various scripts
def scriptsFolder = "$distFolder/scripts"
copy {
from "$rootDir/scripts/autoscaling"
into scriptsFolder
}
def distDirs = files(
"$rootDir/scripts/git-role-management",
"$rootDir/scripts/nfs-roles-management",
)
distDirs.each {
dir ->
copy {
from dir
into "$scriptsFolder/$dir.name"
}
}
copy {
from "$rootDir/workflows/pipe-templates"
into "$distFolder/pipe-templates"
}
copy {
from "$rootDir/elasticsearch-agent/src/main/resources/templates"
into "$distFolder/search-mappings"
}
copy {
from "$rootDir/vm-monitor/src/main/resources/templates"
into "$distFolder/vm-monitor-templates"
}
def distFiles = files(
"$rootDir/api/build/libs/pipeline.jar",
"$rootDir/api/pipeline.sh",
"$rootDir/jwt-generator/build/libs/jwt-generator.jar",
"$rootDir/notifier/smtp/build/libs/notifier.jar",
"$rootDir/docker-comp-scan/build/libs/docker-comp-scan.jar",
"$rootDir/dist/cloud-pipeline-docs.tar.gz",
"$rootDir/elasticsearch-agent/build/libs/elasticsearch-agent.jar",
"$rootDir/data-transfer-service/build/libs/data-transfer-service.jar",
"$rootDir/vm-monitor/build/libs/vm-monitor.jar",
"$rootDir/data-sharing-service/api/build/libs/data-sharing-service.jar",
"$rootDir/billing-report-agent/build/libs/billing-report-agent.jar"
)
distFiles.each {
distFile ->
copy {
from distFile
into distFolder
}
}
}
}
task distZip(type: Zip, dependsOn: installDist) {
version = project.version
group = "distribution"
archiveName "cloud-pipeline.${version}.zip"
destinationDir(file("$project.buildDir/install/dist"))
from("$project.buildDir/install/bin/") {
into "bin/"
}
include "**/**"
}
task distTar(type: Tar, dependsOn: installDist) {
version = project.version
group = "distribution"
compression = Compression.GZIP
archiveName "cloud-pipeline.${version}.tgz"
destinationDir(file("$project.buildDir/install/dist"))
from("$project.buildDir/install/bin/") {
into "bin/"
}
include "**/**"
}
task wrapper(type: Wrapper) {
gradleVersion = '4.10.2'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}
task clean(type: Delete) {
group = "build"
delete(project.buildDir)
}