-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
73 lines (64 loc) · 1.5 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
apply plugin: 'application'
apply plugin: 'idea'
apply plugin: 'java'
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--dirty'
standardOutput = stdout
}
return stdout.toString().trim()
}
compileJava.options.encoding = 'UTF-8'
mainClassName = 'gamer.App'
sourceCompatibility = '1.8'
version = getVersionName()
repositories {
mavenCentral()
}
dependencies {
compile 'commons-cli:commons-cli:1.4+'
compile 'com.google.code.gson:gson:2.8+'
testCompile group: 'junit', name: 'junit', version: '4.12+'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3+'
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:all"
}
}
jar {
manifest {
attributes 'Main-Class': mainClassName
attributes 'Implementation-Version': version
}
}
// Create a single jar with all dependencies.
task fatjar(type: Jar) {
baseName = project.name + '-all'
doFirst {
manifest {
attributes 'Main-Class': mainClassName
attributes 'Implementation-Version': version
}
}
from {
configurations.compile.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
run {
if (project.hasProperty('args')) {
args project.args.split('\\s')
}
jvmArgs = ['-Dfile.encoding=utf8']
}
test {
testLogging.showStandardStreams = false
//// Uncomment if a test hangs.
// beforeTest {
// descriptor -> logger.lifecycle("Running test: " + descriptor)
// }
}