testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
}
+apply from: 'version.gradle'
+
task fatJar(type: Jar) {
archiveName = project.name + '-jar-with-dependencies.jar'
from { (configurations.runtime - configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } }
--- /dev/null
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath group: "org.ajoberstar", name: "gradle-git", version: "1.3.0"
+ }
+}
+
+import org.ajoberstar.grgit.Grgit
+
+task(writeVersion) << {
+ def grgit = Grgit.open(dir: project.rootDir)
+ def version = grgit.resolve.toCommit("HEAD").id
+ def niceVersion = grgit.describe()
+ grgit.close()
+
+ new File("src/generated/resources").mkdirs()
+ project.file("src/generated/resources/version.yaml").withWriter { out ->
+ out.println "id: ${version}"
+ out.println "nice: ${niceVersion}"
+ }
+}
+
+sourceSets {
+ main {
+ resources {
+ srcDirs += "src/generated/resources"
+ }
+ }
+}
+
+processResources {
+ dependsOn(writeVersion)
+}
+