forked from nerdclub-tfg/signal-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
83 lines (69 loc) · 2.61 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import org.gradle.internal.jvm.Jvm
apply plugin: 'java'
repositories {
mavenCentral()
// maven { url "https://jitpack.io" } // See https://stackoverflow.com/questions/18748436/
}
dependencies {
compile 'com.github.turakar:signal4j:1.0.4' // See https://mvnrepository.com/artifact/com.github.turakar/signal4j/1.0.4
// compile 'com.github.kivisade:signal4j:1.1.0' // not yet ready, intended as a replacement for 'com.github.turakar:signal4j:1.0.4' with updated dependencies
compile 'org.json:json:20171018'
compile 'org.apache.commons:commons-lang3:3.0'
compile 'com.google.zxing:core:3.3.0'
compile 'com.google.zxing:javase:3.3.0'
}
ext {
String version
String commit
String buildDate
String javaVersion
}
task collectBuildInfo {
new ByteArrayOutputStream().withStream { os ->
def result = exec {
executable = 'git'
args = ['describe', '--tags']
standardOutput = os
ignoreExitValue = true
}
project.ext.version = result.getExitValue() == 0 ? os.toString().trim() : '0.0.0'
os.reset()
result = exec {
executable = 'sh'
args = ['-c', 'git status --porcelain | read REPLY']
standardOutput = os
ignoreExitValue = true
}
project.ext.version += result.getExitValue() == 0 ? '~dirty' : ''
os.reset()
exec {
executable = 'git'
args = ['rev-parse', 'HEAD']
standardOutput = os
}
project.ext.commit = os.toString().trim()
os.reset()
project.ext.buildDate = new Date().format('yyyy-MM-dd HH:mm:ss')
project.ext.javaVersion = Jvm.current()
}
doLast {
println "Version : $project.ext.version"
println "Git commit : $project.ext.commit"
println "Build date : $project.ext.buildDate"
println "Java version : $project.ext.javaVersion"
}
}
task fatJar(type: Jar, dependsOn: collectBuildInfo) {
manifest {
attributes 'Main-Class': 'org.ephemeris.bot.signal.SignalBot',
'Implementation-Title': 'ephemeris-signal-bot',
'Implementation-Version': project.ext.version ?: 'unknown',
'Git-Commit': project.ext.commit ?: 'unknown',
'Build-Date': project.ext.buildDate ?: 'unknown',
'Java-Version': project.ext.javaVersion ?: 'unknown'
}
baseName = project.name + '-all'
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}