2017-03-20 Now Gogradle can generate HTML reports for test and coverage!
What is Gogradle?
Gogradle is a Gradle plugin which provide modern build support for Golang. Gogradle is deeply inspired by glide(I need to pay respect for it). You can simply think Gogradle as glide+make.
Why Gogradle?
make has a very steep learning curve, thus many people (like me) aren't good at it; Gradle use a DSL with similar syntax to Java to describe a build, which is easier for me.
Makefile and Shell have cross-platform issues, especially on Windows. Thanks to Gradle and JVM, Gogradle provide an excellent cross-platform support and can leverage the whole Java ecosystem
There're many mature plugins in Gradle ecosystem, and it's easy for yourself to implement a plugin to reuse your build code
Gogradle supports project-scoped GOPATH, if you prefer
Gogradle supports existence and switch of multi-version of Go
There's plenty of package management tools in Go community which are not compatible with each other.
Gogradle provides a migration command which enables you to migrate from other tools.
Gogradle is compatible with glide/glock/godep/gom/gopm/govendor/gvt/gbvendor/trash/gpm. When retrieving a dependency package's transitive dependencies, it can recognized lock files of these tools.
Gogradle has a long-term and active development support
Gogradle implements most features of glide and adds some extra features:
Test and coverage reports generation
Multi-version management of Go
IDE support
Declaration and substitution of repositories, which can be used as mirror repositories
If you puzzled over these issues, or you were a Java developer and familiar with Gradle, Gogradle is your choice!
Gogradle's objective is not replacing other tools, it only provides an option for developers.
Gogradle is NOT a toy. 52% of its code are tests to assure its quality. We also tested Github's top 1000 Go repositories as real world scenarios.
Feature
No need to preinstall anything but JDK 8+ (including golang itself)
If you're using JetBrains IDE, then JDK is not required
Supports Go 1.5+ and allow their existence at the same time
Perfect cross-platform support (as long as Java can be run, all tests have passed on OS X 10.11/Ubuntu 12.04/Windows 7)
Project-scope build, needless to set GOPATH
Full-featured package management
Needless to install dependency packages manually, all you need to do is specifying the version
VCS supported: Git/Mercurial
Transitive dependency management
Resolves package conflict automatically
Supports dependency lock
Supports importing dependencies managed by various external tools such as glide/glock/godep/gom/gopm/govendor/gvt/gbvendor/trash/gpm (Based on this report)
Modern production-grade support for automatic build, simple to define customized tasks
Native syntax of gradle
Additional features for users in mainland China who are behind the GFW
Supports shadowsocks proxy
IDE support
Test and coverage report generation
Incremental build
How Gogradle works
Gogradle's work is based on vendor mechanism. You declare your build dependencies and build logic with Gradle DSL in build.gradle, and Gogradle will resolve all dependencies and potential package conflict, then install them into vendor directory and execute a build. In this course, dependency packages will be flattened to avoid issues. Later, you can lock your resolved dependencies to ensure a reproducible build. It's up to you whether to check in vendor directory or not.
请发表评论