X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=build.gradle;h=d9c1d3717a95b128e0c01385bb9e8d230c3409b1;hb=44cf7e2699e1a98263d2ac8e3cfdef16e52b0394;hp=9057834b5872920f1574abf8c4cb6da91db2230e;hpb=268fec7d71c945bd95c320806ecbd1a0b3d01c78;p=rhynodge.git diff --git a/build.gradle b/build.gradle index 9057834..d9c1d37 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,6 @@ apply plugin: "java" +apply plugin: "kotlin" +apply plugin: "war" apply plugin: "jacoco" apply plugin: "idea" @@ -14,11 +16,24 @@ version = "0.1" sourceCompatibility = 1.8 targetCompatibility = 1.8 +buildscript { + ext.kotlinVersion = '1.0.2' + + repositories { + mavenCentral() + } + dependencies { + classpath group: "org.ajoberstar", name: "gradle-git", version: "1.1.0" + classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: "$kotlinVersion" + } +} + repositories { mavenCentral() } dependencies { + compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "$kotlinVersion" compile group: "com.google.guava", name: "guava", version: "14.0-rc1" compile group: "log4j", name: "log4j", version: "1.2.17" compile group: "org.apache.httpcomponents", name: "httpclient", version: "4.4" @@ -28,6 +43,7 @@ dependencies { compile group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.1.2" compile group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.1.2" compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.1.2" + compile group: "com.google.inject", name: "guice", version: "4.0" testCompile group: "junit", name: "junit", version:"4.12" testCompile group: "org.hamcrest", name: "hamcrest-library", version:"1.3" @@ -42,8 +58,34 @@ task fatJar(type: Jar) { ) } from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } + from { sourceSets.generated.resources.srcDirs } with jar dependsOn test } +task createVersion() { + sourceSets { + generated { + resources { + srcDir "src/generated/resources" + } + } + } + processResources.dependsOn(createVersion) +} + + +import org.ajoberstar.grgit.Grgit +createVersion << { + def gitRepo = Grgit.open(".") + version = gitRepo.describe() + new File("src/generated/resources").mkdirs() + new File("src/generated/resources/version.txt").withWriter() { it.write(version) } +} + +war { + classpath sourceSets.generated.output + dependsOn(test) +} + /* vim: set ts=4 sw=4 et: */