Gradle plugin which provides an exec task that works on Unix or Windows-based systems
Releases of this plugin are hosted on Gradle's Plugin Repository. Apply the plugin to your project using one of the two methods below.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'gradle.plugin.com.github.jlouns:gradle-cross-platform-exec-plugin:0.5.0'
}
}
apply plugin: 'com.github.jlouns.cpe'
plugins {
id 'com.github.jlouns.cpe' version '0.5.0'
}
This plugin enables a CrossPlatformExec
task type in your buildscript which behaves exactly like a typical Gradle
Exec
task, except that it normalizes calls to work across operating systems. It does this by:
- Searching for a file matching the name of the command and executing the matching file if it exists
- Files ending with .bat, .cmd, and .exe are matched on Windows
- Files ending with .sh and nothing are matched on *nix
- Prepending each command with
cmd /c
on Windows
To define a CrossPlatformExec
task, simply specify the task type
:
task foo(type: CrossPlatformExec) {
commandLine 'echo', 'bar'
}
All of the same options for a typical Exec task are available.
MIT © Jonathan Lounsbury