-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
63 lines (48 loc) · 1.79 KB
/
build.gradle.kts
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
import java.util.Locale.ROOT
tasks.register("setUpRabbitMQ") {
project.ext["args"] = ""
project.ext["linuxScript"] = "./SetUpRabbitMQ.sh"
project.ext["windowsScript"] = "SetUpRabbitMQ.cmd"
project.ext["workingDir"] = "./src/main/resources/setup/rabbitmq"
finalizedBy("executeScript")
}
tasks.register("setUpFireMock") {
project.ext["args"] = ""
project.ext["linuxScript"] = "./SetUpFireMock.sh"
project.ext["windowsScript"] = "SetUpFireMock.cmd"
project.ext["workingDir"] = "./src/main/resources/setup/firemock"
finalizedBy("executeScript")
}
tasks.register("setUpCleanDatabase") {
project.ext["args"] = "clean"
finalizedBy("setUpDatabase")
}
tasks.register("setUpTestDatabase") {
project.ext["args"] = "test"
finalizedBy("setUpDatabase")
}
tasks.register("setUpDatabase") {
project.ext["linuxScript"] = "./SetUpDatabase.sh"
project.ext["windowsScript"] = "SetUpDatabase.cmd"
project.ext["workingDir"] = "./src/main/resources/setup/mysql"
finalizedBy("executeScript")
}
tasks.register("setUpMongoDatabase") {
project.ext["args"] = ""
project.ext["linuxScript"] = "./SetUpMongoDatabase.sh"
project.ext["windowsScript"] = ""
project.ext["workingDir"] = "./src/main/resources/setup/mongo"
finalizedBy("executeScript")
}
tasks.register<Exec>("executeScript") {
workingDir = File(project.ext["workingDir"].toString())
val args = project.ext["args"].toString()
val linuxScript = project.ext["linuxScript"].toString()
val windowsScript = project.ext["windowsScript"].toString()
val os = System.getProperty("os.name").lowercase(ROOT)
commandLine =
when {
os.contains("windows") -> mutableListOf("cmd", "/c", windowsScript, args)
else -> mutableListOf(linuxScript, args)
}
}