-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
55 lines (46 loc) · 1.24 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
apply plugin: "java"
// get git version
def describeOutput = new ByteArrayOutputStream()
project.exec({
commandLine(["git", "describe", "HEAD", "--tags"])
standardOutput = describeOutput
})
def gitCommit = describeOutput.toString().replace("\n", "")
def suffixOutput = new ByteArrayOutputStream()
project.exec({
commandLine(["bash", "-c", "git status --porcelain | head -n 1 | sed 's/..*/-dev/'"])
standardOutput = suffixOutput
})
def modificationSuffix = suffixOutput.toString().trim().replace("\n", "")
def gitVersion = gitCommit + modificationSuffix
compileJava {
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
String mainClass = "mapper.Main"
jar {
manifest {
attributes 'Main-Class': mainClass
}
}
dependencies {
test {
testImplementation "junit:junit:4.13"
}
}
task release(type: Copy) {
from "build/libs"
include "mapper.jar"
into "build/libs"
rename("mapper.jar", "mapper-${gitVersion}.jar")
dependsOn("build")
}
def expandProperties = new HashMap<String, String>()
expandProperties["mapperVersion"] = gitVersion
project.tasks["processResources"].configure { processTask ->
processTask.expand(expandProperties)
processTask.inputs.property("properties", expandProperties)
}
repositories {
mavenCentral()
}