Added Cygwin, MinGW and MSYS support.

This commit is contained in:
Erik C. Thauvin 2017-04-28 10:55:59 -07:00
parent 395fa127b9
commit 9fb31c09e5
2 changed files with 19 additions and 7 deletions

View file

@ -45,7 +45,7 @@ exec {
### `args`
The full command line arguments including the executable and all parameters.
The full command line including the executable and all arguments.
```kotlin
exec {
@ -74,9 +74,12 @@ The following predefined values are available:
Name | Operating System
--------------|-----------------------
`Os.CYGWIN` | Cygwin
`Os.FREEBSD` | FreeBSD
`Os.LINUX` | Linux
`Os.MAC` | Apple Macintosh / OS X
`Os.MINGW` | Minimalist GNU for Windows
`OS.MSYS` | MSYS
`Os.OPENVMS` | OpenVMS
`Os.OS400` | OS/400
`Os.SOLARIS` | Solaris / SunOS
@ -118,7 +121,7 @@ exec {
## taskName
Additionally, you can specify a task name to easily identify multiple `exec` directives.
Additionally, you can specify a task name to easily identify multiple `exec` tasks.
```kotlin
exec {
@ -162,7 +165,4 @@ exec {
commandLine("/bin/sh", "-c", "./stop.sh 2> error.txt", os = setOf(Os.LINUX))
commandLine("cmd", "/c", "stop.bat 2> error.txt", os = setOf(Os.WINDOWS))
}
```
```

View file

@ -102,6 +102,18 @@ class ExecPlugin @Inject constructor(val taskContributor: TaskContributor, val c
Os.OS400 -> {
return curOs.contains("os/400")
}
Os.CYGWIN -> {
val cygwin: String? = System.getenv("ORIGINAL_PATH")
return cygwin?.contains("/cygdrive/") ?: false
}
Os.MINGW -> {
val mingw: String? = System.getenv("MSYSTEM")
return mingw?.startsWith("MINGW") ?: false
}
Os.MSYS -> {
val msys: String? = System.getenv("MSYSTEM")
return msys?.startsWith("MSYS") ?: false
}
}
}
@ -184,7 +196,7 @@ enum class Fail {
}
enum class Os {
FREEBSD, LINUX, MAC, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
CYGWIN, FREEBSD, LINUX, MAC, MINGW, MSYS, OPENVMS, OS400, SOLARIS, TANDEM, WINDOWS, ZOS
}
data class CommandLine(var args: List<String> = emptyList(), var dir: String = "", var os: Set<Os> = emptySet(),