This repository has been archived by the owner on Nov 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
67 lines (56 loc) · 1.58 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
apply plugin: 'java'
version = '1.0'
def mainClassName = 'com.vkb.Vkb'
def fatJarFolder = 'build/libs/'
def tempDistFolder = 'build/tmp-dist/'
def confFolder = 'conf/'
def dbFolder = 'build/tmp-dist/db/'
def distConfFolder = 'build/tmp-dist/conf/'
def startupBatFileName = 'startup.bat'
def startupShFileName = 'startup.sh'
def startupShFileHead = '#!/bin/sh\n'
def startupScript = 'java -Dtinylog.configuration=conf/tinylog.properties -jar ' + project.name + '-' + version + '.jar'
def distFolder = 'build/dist'
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': mainClassName
}
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task copyJar(dependsOn: fatJar, type: Copy) {
from fatJarFolder
into tempDistFolder
}
task copyConf(dependsOn: copyJar, type: Copy) {
from confFolder
into distConfFolder
}
task dist(dependsOn: copyConf, type: Zip) {
doFirst {
def f1 = new File(tempDistFolder + startupBatFileName)
f1.text = startupScript
def f2 = new File(tempDistFolder + startupShFileName)
f2.text = startupShFileHead + startupScript
includeEmptyDirs = true
new File(dbFolder).mkdirs()
}
from tempDistFolder
into project.name
destinationDir file(distFolder)
/*
doLast{
delete tempDistFolder
}
*/
}
task stage(dependsOn: dist)
repositories {
mavenCentral()
}
dependencies {
compile 'org.tinylog:tinylog:1.0.2'
compile 'org.json:json:20150729'
compile 'org.mapdb:mapdb:2.0-beta8'
}