-
Notifications
You must be signed in to change notification settings - Fork 65
/
build.gradle
147 lines (107 loc) · 3.51 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
143
144
145
146
147
plugins {
id 'java'
id "org.jetbrains.kotlin.jvm" version "1.5.31"
id "com.github.johnrengelman.shadow" version "7.0.0"
id "com.github.breadmoirai.github-release" version "2.2.12"
id "com.github.ben-manes.versions" version "0.39.0"
}
group = 'atm.bloodworkxgaming'
version = '2.3.1'
sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
name = 'DVS1'
url = 'https://dvs1.progwml6.com/files/maven'
}
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.29'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.8'
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.13.3")
implementation ("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// https://mvnrepository.com/artifact/org.fusesource.jansi/jansi
implementation group: 'org.fusesource.jansi', name: 'jansi', version: '2.3.4'
}
shadowJar {
classifier = ""
}
jar {
manifest {
attributes(
'Class-Path': configurations.runtimeClasspath.collect { it.getName() }.join(' '),
'Main-Class': 'atm.bloodworkxgaming.serverstarter.ServerStarterKt'
)
}
}
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
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 = "BloodWorkXGaming"
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"
}
}