A Gradle Plugin Providing Full Support for Go
build
taskNow Gogradle leverage Gradle's incremental build mechanism to improve build performance.
If the following things are not changed between two build, build
task will be marked as UP-TO-DATE
and skip.
*_test.go
but including source code in vendor)buildTags
defined in configuration
outputLocation
defined in build task. Note if this value is not set, incremental build won't take effect.cover
taskNow cover
task is incremental:
test
taskgo tool cover
command.Now Gogradle will print package coverage rate and total coverage rate in --info
log level. This make it much more convenient to read them from online CI log, e.g. travis.
In Gogradle 0.8, configuring multiple commands in Go
task will result in the latter declaration overwriting the former declaration.
Now it's allowed to configure multiple commands in Go
task:
task myBuild(type: Go) {
go 'build -o build/${GOOS}/${GOARCH}/app1a${GOEXE} gitrepo/apps/app1/app1a'
go 'build -o build/${GOOS}/${GOARCH}/app1b${GOEXE} gitrepo/apps/app1/app1b'
}
Now you can set environment variables for Test task:
test {
environment 'ENV1', 'VALUE1'
environment ENV2: 'VALUE', ENV3: 'VALUE3'
}
To improve user experience, Gogradle excludes some unrecognizable packages by default since 0.9. See Global exclude packages for more details.
Now repositories ending with .vcs
are supported by Gogradle.
Previously, a custom go build command declaration is:
go('build -v github.com/my/project', { stdoutLine ->
println stdoutLine
}, { stderrLine ->
println stderrLine
})
or
go('build -v github.com/my/project', writeTo('stdout.txt), devNull())
To make it more readable, now the DSL is changed to:
go('build -v github.com/my/project') {
stdout { line ->
println line
}
stderr { line ->
println line
}
}
and
go('build -v github.com/my/project') {
stdout writeTo('stdout.txt')
stderr devNull()
}
coverage
task is renamed to cover
nowPreviously, coverage
task's alias is goCover
, which puzzles users a lot. Now it's renamed to cover
and its alias version keeps unchanged.
continueWhenFail
In most tasks, property continueWhenFail
is deprecated and superseded by continueOnFailure
to keep it consistent with official property.
You can still use this property, but Gogradle will render a deprecation warning on console.
Please don't hesitate to report bugs or request features. Any contributions are always welcomed.
Gogradle 0.8.1 is a patch release. It fixed #183 #184 #189 .
Gogradle 0.8.0 has been released.
In this release, a lot of improvements have been made:
branch
in dependency declaration.Thanks for the contributors, I really appreciate your PRs.
gradle tasks
output (#117)build.targetPlatforms
(#128)To make build.gradle
more declarative, now you should declare custom command line arguments out of doLast
block. For example,
Before 0.7.0
:
task myTask(type:com.github.blindpirate.gogradle.Go) {
doLast {
go 'build github.com/my/package'
}
}
0.7.0+
:
task myTask(type:com.github.blindpirate.gogradle.Go) {
go 'build github.com/my/package'
}
See #130
Gogradle 0.6.5 is a minor release
Gogradle 0.6.4 is a minor release.
Gogradle 0.6.3 is a minor release.
It fixes #112 .
-Dgogradle.refresh
instead of --refresh-dependencies
due to potential performance issues.revision
in vendor.json
.After careful consideration, default task names are set to build
/test
, etc. To solve the task name conflict problem, please consult documentation and examples.
Fix bugs:
GOPATH
can not be recognizedinit()
method