• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

johnrengelman/gradle-processes: Gradle Processes Plugin - Create and manage fork ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

johnrengelman/gradle-processes

开源软件地址(OpenSource Url):

https://github.com/johnrengelman/gradle-processes

开源编程语言(OpenSource Language):

Groovy 80.0%

开源软件介绍(OpenSource 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 updated version of the plugin is tested against Gradle versions 4.5 onwards (final versions only).

Due to internal gradle API changes (some of which this plugin uses) you have to use the older version 0.3.0 of the plugin on gradle version < 4.5!

How To Use

Starting from gradle 4.5: Apply the plugin to your Gradle build:

plugins {
    id 'com.github.johnrengelman.processes' // TODO add version
}

If using a version prior to gradle 4.5: Apply the plugin to your Gradle build:

plugins {
    id "com.github.johnrengelman.processes" version "0.3.0"
}

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

Building the plugin

This should build everything and run the tests:

./gradlew build



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap