This repository has been archived by the owner on May 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
142 lines (105 loc) · 3.3 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
plugins {
id 'java'
id "org.jetbrains.kotlin.jvm" version "1.2.51"
id "com.github.johnrengelman.shadow" version "2.0.4"
id "com.github.breadmoirai.github-release" version "2.2.9"
}
group = 'atm.bloodworkxgaming'
version = '2.1.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
name = 'DVS1'
url = 'http://dvs1.progwml6.com/files/maven'
}
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.yaml', name: 'snakeyaml', version: '1.21'
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile 'com.squareup.okhttp3:okhttp:3.10.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.4'
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// https://mvnrepository.com/artifact/org.fusesource.jansi/jansi
compile group: 'org.fusesource.jansi', name: 'jansi', version: '1.17.1'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.16.20'
}
shadowJar {
classifier = ""
}
jar {
manifest {
attributes(
'Class-Path': configurations.compile.collect { it.getName() }.join(' '),
'Main-Class': 'atm.bloodworkxgaming.serverstarter.ServerStarterKt'
)
}
}
tasks.build.dependsOn shadowJar
task copyJar(type: Copy) {
dependsOn build
from file("$buildDir/libs/serverstarter-${version}.jar")
into file("$buildDir/dist/serverstarter-$version/")
}
task packageDist(type: Copy) {
group = "build"
dependsOn copyJar
from file("src/main/resources/startserver.bat")
from file("src/main/resources/startserver.sh")
from file("server-setup-config.yaml")
into file("$buildDir/dist/serverstarter-$version/")
filter { it.replaceAll("@@serverstarter-libVersion@@", version as String) }
}
task zipDist (type: Zip) {
dependsOn packageDist
group = "build"
from file("$buildDir/dist/serverstarter-$version/")
include '*'
include '*/**'
archiveName = "serverstarter-${version}.zip"
destinationDir = file("$buildDir/release/")
}
githubRelease {
token = getGithubKey()
owner = "Yoosk"
repo = "ServerStarter"
releaseAssets file("$buildDir/release/serverstarter-${version}.zip")
}
tasks.githubRelease.dependsOn zipDist
static String getGithubKey(){
if (new File('secrets.properties').exists()) {
Properties props = new Properties()
props.load(new FileInputStream(new File('secrets.properties')))
return props['GITHUB_TOKEN']
}
return ""
}
task depsize {
group = "help"
doLast {
def size = 0
def formatStr = "%,10.2f"
configurations.default.collect { it.length() / (1024 * 1024) }.each { size += it }
def out = new StringBuffer()
out << 'Total dependencies size:'.padRight(45)
out << "${String.format(formatStr, size)} Mb\n\n"
configurations
.default
.sort { -it.length() }
.each {
out << "${it.name}".padRight(45)
out << "${String.format(formatStr, (it.length() / 1024))} kb\n"
}
println(out)
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}