-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean.main.kts
executable file
·30 lines (23 loc) · 913 Bytes
/
clean.main.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
#!/usr/bin/env kotlin
import java.io.File
cmd("rm -rf build")
cmd("rm -rf .gradle")
cmd("rm -rf .idea")
cmd("rm -rf build", "./gradlePlugin/blueprint-configuration")
cmd("rm -rf .gradle", "./gradlePlugin/blueprint-configuration")
cmd("rm -rf build", "./gradlePlugin/blueprint-dependency")
cmd("rm -rf .gradle", "./gradlePlugin/blueprint-dependency")
cmd("rm -rf build", "./gradlePlugin/blueprint-tools")
cmd("rm -rf .gradle", "./gradlePlugin/blueprint-tools")
fun cmd(command: String, path: String = "./"): Boolean {
val commands = command.split(" ")
val arguments = commands.subList(1, commands.size)
val result = ProcessBuilder()
.directory(File(path))
.command(commands[0], *arguments.toTypedArray())
.redirectError(ProcessBuilder.Redirect.INHERIT)
.redirectOutput(ProcessBuilder.Redirect.INHERIT)
.start()
.waitFor()
return result == 0
}