-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
116 lines (100 loc) · 3.25 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
plugins {
id 'java-library'
id "de.undercouch.download" version "5.0.4"
id "com.github.johnrengelman.shadow" version "5.2.0"
}
group 'org.wakingstones'
version '3.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
maven {
name = 'gradle-plugins'
url = 'https://plugins.gradle.org/m2'
}
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven'
}
maven {
name = 'forge'
url = 'https://maven.minecraftforge.net/'
}
maven {
name = 'minecraft'
url = 'https://libraries.minecraft.net/'
}
mavenCentral()
}
dependencies {
implementation fileTree(dir: 'lib', include: ['*.jar', '*.cfg'], exclude: [
"gson-*.jar",
"guava-*.jar"
])
implementation 'org.spongepowered:mixin:0.8.5'
implementation('net.minecraft:launchwrapper:1.11') {
exclude module: 'lwjgl'
}
implementation 'com.google.guava:guava:21.0'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'org.ow2.asm:asm-debug-all:5.2'
}
tasks.register('downloadZipFile', Download) {
onlyIf {
!file("callersbane.zip").exists()
}
src 'https://download.scrolls.com/callersbane/server/CallersBane-Server-2.0.1.zip'
dest new File('callersbane.zip')
}
tasks.register('copyExistingZip', Copy) {
from "callersbane.zip"
into "${buildDir}/server.zip"
}
tasks.register('unzip', Copy) {
dependsOn(downloadZipFile)
from zipTree(downloadZipFile.dest)
into "${buildDir}/server"
}
tasks.register('moveJar', Copy) {
dependsOn(unzip)
from "${buildDir}/server/CallersBane-Server/Server.jar"
into "lib"
rename "Server.jar", "callersbane-server.jar"
}
tasks.register('copyLibs', Copy) {
dependsOn(unzip)
from "${buildDir}/server/CallersBane-Server/lib/"
include "*.jar"
into "lib"
}
tasks.register('cleanup', Delete) {
dependsOn(copyLibs, moveJar)
delete "${buildDir}/server", "${buildDir}/server.zip"
}
tasks.register('copyToLib', Copy) {
//removes the included libraries that Caller's Bane has
//from(configurations.compile - fileTree("lib"))
from configurations.compileClasspath - fileTree("lib")
into "${buildDir}/libs/lib"
}
tasks.register('prepareWorkspace', GradleBuild) {
tasks = ['downloadZipFile', 'copyExistingZip', 'unzip', 'moveJar', 'copyLibs', 'cleanup']
}
tasks.register('generateRunScript') {
doLast {
new File("$buildDir/libs/startServer.sh").text = """java -Dio.netty.epollBugWorkaround=true -Dscrolls.mode=PROD -Dscrolls.node.id=test-server -jar turtles-${version}.jar"""
new File("$buildDir/libs/startServer.bat").text = """java -Dio.netty.epollBugWorkaround=true -Dscrolls.mode=PROD -Dscrolls.node.id=test-server -jar turtles-${version}.jar"""
}
}
jar {
manifest {
attributes(
"Class-Path": "Server.jar cfg/ " + fileTree("lib").collect({ relativePath(it) }).join(" ").replaceAll("\\\\", "/")
+ " lib/" + configurations.compileClasspath.filter({ it.isFile() }).files.name.join(" lib/"),
"Main-Class": "org.wakingstones.turtles.core.Main"
)
}
exclude("**/hibernate.cfg.xml")
}
shadowJar {
}
tasks.named("build") { dependsOn(generateRunScript, copyToLib) }