forked from eclipse/jifa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jifa.gradle
92 lines (78 loc) · 3.16 KB
/
jifa.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
/********************************************************************************
* Copyright (c) 2020, 2021 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
********************************************************************************/
apply from: "$rootDir/gradle/base.gradle"
task deleteSSHConfig(type: Delete) {
delete "${rootProject.rootDir}/backend/config/jifa-ssh-key", "${rootProject.rootDir}/backend/config/jifa-ssh-key.pub"
}
task generateSSHConfig(dependsOn: deleteSSHConfig, type: Exec) {
commandLine "ssh-keygen", "-b", "2048", "-t", "rsa", "-f", "${rootProject.rootDir}/backend/config/jifa-ssh-key", "-q"
}
task copySSHConfig(dependsOn: generateSSHConfig, type: Copy) {
from "${rootProject.rootDir}/backend/config/jifa-ssh-key" as Object,
"${rootProject.rootDir}/backend/config/jifa-ssh-key.pub" as Object
into "${rootProject.rootDir}/artifacts/config" as Object
}
task copyMasterDist(type: Copy, dependsOn: ':backend:master:build') {
from "${rootProject.rootDir}/backend/master/build/distributions/master-${project.version}.zip" as Object
into "${rootProject.rootDir}/artifacts" as Object
}
task copyWorkerDist(type: Copy, dependsOn: ':backend:worker:build') {
from "${rootProject.rootDir}/backend/worker/build/distributions/worker-${project.version}.zip" as Object
into "${rootProject.rootDir}/artifacts" as Object
}
task compressFrontendDist(type: Zip) {
from "${rootProject.rootDir}/frontend/build"
destinationDirectory = file("${rootProject.rootDir}/artifacts")
archiveBaseName.set('frontend')
archiveVersion.set(project.version)
archiveExtension.set('zip')
}
task buildWorker {
group 'Build Jifa'
description 'Build worker and frontend only.'
doFirst {
ant.replaceregexp(match:'workerOnly.*?,', replace:'workerOnly: true,', flags:'g', byline:true) {
fileset(dir: "${rootProject.rootDir}/frontend/src", includes: 'config.js')
}
}
dependsOn ':frontend:build'
dependsOn ':backend:worker:build'
dependsOn copySSHConfig, copyWorkerDist, compressFrontendDist
}
task buildJifa{
group 'Build Jifa'
description 'Build all components: master, worker, and frontend.'
dependsOn ':frontend:build'
dependsOn ':backend:master:build'
dependsOn ':backend:worker:build'
dependsOn copySSHConfig, copyMasterDist, copyWorkerDist, compressFrontendDist
}
task clean {
doFirst {
delete files("${projectDir}/artifacts")
}
}
class TaskListener implements TaskExecutionListener{
@Override
void beforeExecute(Task task) {
println "===== " + task.name + " Start ====="
}
@Override
void afterExecute(Task task, TaskState state) {
println "===== " + task.name + " End ====="
}
}
if (project.properties.containsKey("verbose")) {
gradle.addListener(new TaskListener())
}
defaultTasks 'buildJifa'