gradle-cross-platform-exec-plugin editorconfig travis-ci

Gradle plugin which provides an exec task that works on unix or windows-based systems

gradle-cross-platform-exec-plugin

Build Status

Gradle plugin which provides an exec task that works on Unix or Windows-based systems

Installing

Releases of this plugin are hosted on Gradle’s Plugin Repository. Apply the plugin to your project using one of the two methods below.

Gradle 2.0 and older

buildscript {
	repositories {
		maven {
			url "https://plugins.gradle.org/m2/"
		}
	}
	dependencies {
		classpath 'gradle.plugin.com.github.jlouns:gradle-cross-platform-exec-plugin:0.4.1'
	}
}

apply plugin: 'com.github.jlouns.cpe'

Gradle 2.1 and newer

plugins {
	id 'com.github.jlouns.cpe' version '0.4.1'
}

Usage

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:

  1. 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
  2. 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.

License

MIT © Jonathan Lounsbury

Related Repositories

gradle-cross-platform-exec-plugin

gradle-cross-platform-exec-plugin

Gradle plugin which provides an exec task that works on unix or windows-based systems ...


Top Contributors

jlouns iamakulov

Releases

-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.0 zip tar
-   v0.2.0 zip tar
-   v0.1.0 zip tar