Gradle support

Most of the work done by Jason.