Gogradle is a gradle plugin which provides support for building golang.
2017-06-23 Gogradle is awarded Gradle Plugin of the Year 2017. See the talk on Gradle Summit 2017.
2017-12-17 Now Gogradle can build 817 of Github’s top 1000 Go repositories WITHOUT any extra configuration!
2017-03-20 Now Gogradle can generate HTML reports for test and coverage!
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
.
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 ecosystemGOPATH
, if you preferglide/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 implements most features of glide
and adds some extra features:
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.
JDK 8+
(including golang itself)
Java
can be run, all tests have passed on OS X 10.11/Ubuntu 12.04/Windows 7)GOPATH
build
/test
dependencies are managed separatelyGogradle’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.
See here for examples.
Test report
Coverage report
If you like Gogradle, star it please.
Please feel free to submit an issue.
Fork and PR are always welcomed.
Gogradle is developed in IntelliJ IDEA. You can run ./gradlew idea
and open the generated .ipr
files in IDEA.
Please make sure all checks passed via ./gradlew check
.