-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
45 lines (40 loc) · 1.05 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
plugins {
id 'java'
}
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--abbrev=0'
standardOutput = stdout
}
def tag = stdout.toString().trim()
stdout.reset()
exec {
commandLine 'git', 'describe', '--all'
standardOutput = stdout
}
if ('heads/master'.equalsIgnoreCase(stdout.toString().trim()) || stdout.toString().trim().contains(tag)) {
return tag
} else {
// Adding the branch name to the version
def ver = stdout.toString().trim()
return tag + '-' + ver.substring(ver.indexOf('/') + 1)
}
}
catch (ignored) {
return "0.0"
}
}
dependencies {
compile files('lib/js.jar')
}
sourceSets.main.java.srcDirs = ['src']
sourceCompatibility = 1.7
targetCompatibility = 1.7
version = getVersionName()
jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}