GithubHelp home page GithubHelp logo

axls / gradle2-processes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnrengelman/gradle-processes

0.0 2.0 0.0 421 KB

Gradle Processes Plugin - Create and manage forked processes

License: Apache License 2.0

Groovy 80.38% Java 19.62%

gradle2-processes's Introduction

gradle-processes

Gradle Processes Plugin - Create and manage forked processes.

This Gradle plugin provides the capability to create forked processes from a Gradle build. It's primary goal is to bolster the built in capabilities of Gradle which allow for processing forking only in a synchronous manner.

Compatibility Notes

This plugin is tested against Gradle versions 1.8 - 1.11 (final versions only).

How To Use

First, add the BinTray JCenter repository and the plugin library to your build's buildscript.

buildscript {
    respositories {
       jcenter()
    }
    dependencies {
       classpath 'com.github.jengelman.gradle.plugins:gradle-processes:0.3.0'
    }
}

Second, apply the plugin to your Gradle build:

apply plugin: 'com.github.johnrengelman.processes'

Capabilities

Process Forking

ProcessHandle handle = project.procs.fork {
    <process configuration> See [Exec](http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Exec.html)
}

ProcessHandle handle = project.procs.javafork {
    <process configuration> See [JavaExec](http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.JavaExec.html)
}

Process Joining

project.procs.waitForFinish(handle)

Handling Multiple Processes

ProcessHandle handle = project.procs.javafork { ... }
ProcessHandle handle2 = project.procs.javafork { ... }
project.procs.waitForFinish([handle, handle2])

Forking Tasks

task fork(type: Fork) {
  // Configure the same as the Exec task
}

task javafork(type: JavaFork) {
  // Configure the same as the JavaExec task
}

Accessing a Forked Tasks Process

task fork(type: Fork) {
  // Configure task
}

task waitForFork() << {
  fork.processHandle.waitForFinish()
}

Using the forked tasks can allow for starting/stopping processes for things like test infrastructure.

task startServer(type: Fork) {
  // Start some external service
}

task stopServer << {
  startServer.processHandle.abort()
}

test.dependsOn startServer
test.finalizedBy stopServer

gradle2-processes's People

Contributors

johnrengelman avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.