Create file with version information on build
[rhynodge.git] / build.gradle
1 apply plugin: "java"
2 apply plugin: "jacoco"
3 apply plugin: "idea"
4
5 idea {
6         project {
7                 languageLevel = "1.8"
8         }
9 }
10
11 group = "net.pterodactylus"
12 version = "0.1"
13
14 sourceCompatibility = 1.8
15 targetCompatibility = 1.8
16
17 buildscript {
18     repositories {
19         mavenCentral()
20     }
21     dependencies {
22         classpath group: "org.ajoberstar", name: "gradle-git", version: "1.1.0"
23     }
24 }
25
26 repositories {
27         mavenCentral()
28 }
29
30 dependencies {
31     compile group: "com.google.guava", name: "guava", version: "14.0-rc1"
32     compile group: "log4j", name: "log4j", version: "1.2.17"
33     compile group: "org.apache.httpcomponents", name: "httpclient", version: "4.4"
34     compile group: "org.jsoup", name: "jsoup", version: "1.7.1"
35     compile group: "javax.mail", name: "mail", version: "1.4.6-rc1"
36     compile group: "org.apache.commons", name: "commons-lang3", version: "3.1"
37     compile group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.1.2"
38     compile group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: "2.1.2"
39     compile group: "com.fasterxml.jackson.core", name: "jackson-databind", version: "2.1.2"
40
41     testCompile group: "junit", name: "junit", version:"4.12"
42     testCompile group: "org.hamcrest", name: "hamcrest-library", version:"1.3"
43     testCompile group: "org.mockito", name: "mockito-core", version:"1.9.5"
44 }
45
46 task fatJar(type: Jar) {
47         baseName = project.name + "-all"
48         manifest {
49                 attributes(
50                         "Main-Class": "net.pterodactylus.rhynodge.engine.Starter"
51                 )
52         }
53         from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
54         with jar
55         dependsOn test
56 }
57
58 task createVersion() {
59     sourceSets {
60         generated {
61             resources {
62                 srcDir "src/generated/resources"
63             }
64         }
65     }
66     processResources.dependsOn(createVersion)
67 }
68
69
70 import org.ajoberstar.grgit.Grgit
71 createVersion << {
72     def gitRepo = Grgit.open(".")
73     version = gitRepo.describe()
74     new File("src/generated/resources").mkdirs()
75     new File("src/generated/resources/version.txt").withWriter() { it.write(version) }
76 }
77
78 /* vim: set ts=4 sw=4 et: */