-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathbuild.gradle
240 lines (212 loc) · 6.67 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
buildscript {
repositories {
mavenCentral()
maven {
name 'prok'
url 'https://repo.prok.pw/'
}
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'//files('SForgeGradle-2.2-SNAPSHOT.jar')//'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
//classpath files('FG.jar')
}
}
apply plugin: 'java'
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'net.minecraftforge.gradle.launch4j'
group = 'luohuayu.CatServer'
version = '1.0.3'
repositories {
clear()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name 'minecraft'
url 'https://libraries.minecraft.net/'
}
maven {
name 'spigot'
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name 'maven'
url 'https://mvnrepository.com/artifact/'
}
maven {
name 'prok'
url 'https://repo.prok.pw/'
}
mavenCentral()
}
configurations{
compile.extendsFrom libraries
libraries
}
dependencies {
libraries 'it.unimi.dsi:fastutil:7.0.12_mojang'
libraries 'jline:jline:2.13'
libraries 'org.apache.commons:commons-lang3:3.3.2'
libraries 'com.mojang:authlib:1.5.22'
libraries 'com.mojang:realms:1.9.8'
libraries 'io.netty:netty-all:4.0.23.Final'
libraries 'net.sf.jopt-simple:jopt-simple:4.7'
libraries 'commons-lang:commons-lang:2.6'
libraries 'commons-io:commons-io:1.3.2'
libraries 'org.avaje:ebean:2.8.1'
libraries 'com.googlecode.json-simple:json-simple:1.1'
libraries 'org.yaml:snakeyaml:1.15'
libraries 'com.google.guava:guava:20.0'
libraries 'org.xerial:sqlite-jdbc:3.7.2'
libraries 'mysql:mysql-connector-java:5.1.14'
libraries 'net.sf.trove4j:trove4j:3.0.3'
libraries 'org.apache.logging.log4j:log4j-core:2.10.0'
libraries 'net.md-5:SpecialSource:1.8.0'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
jar{
into('lib') {
from configurations.libraries
}
exclude "**/configurations/**"
exclude "**/META-INF/**"
exclude "log4j2.xml"
}
minecraft {
version = "1.10.2"
mappings = 'snapshot_nodoc_20161111'
workspaceDir = "projects"
versionJson = "jsons/1.10.2-catserver-dev.json"
buildUserdev = false
buildInstaller = false
installerVersion = '1.5'
def common = {
patchPrefixOriginal "../src-base/minecraft"
patchPrefixChanged "../src-work/minecraft"
/* mainClassClient "net.minecraft.launchwrapper.Launch"
tweakClassClient "net.minecraftforge.fml.common.launcher.FMLTweaker"*/
mainClassServer "net.minecraft.launchwrapper.Launch"
tweakClassServer "net.minecraftforge.fml.common.launcher.FMLServerTweaker"
}
projects {
forge {
rootDir "forge/"
patchDir "forge/patches/minecraft/"
patchAfter "clean"
genPatchesFrom "clean"
genMcpPatches = false
applyMcpPatches = false
s2sKeepImports = true
//dchImports = true
//ignoreWhiteSpaces = false
with common
}
catserver {
rootDir "."
patchDir "patches/"
patchAfter "forge"
genPatchesFrom "forge"
genMcpPatches = true
applyMcpPatches = true
s2sKeepImports = true
//dchImports = true
//ignoreWhiteSpaces = false
with common
}
}
}
installer {
classifier = 'installer'
from "forge/src/main/resources/forge_logo.png"
rename "forge_logo\\.png", "big_logo.png"
}
launch4j {
jar = installer.archivePath.canonicalPath
outfile = file("build/distributions/${project.name}-${project.version}-installer-win.exe").canonicalPath
icon = file('icon.ico').canonicalPath
manifest = file('l4jManifest.xml').canonicalPath
jreMinVersion = '1.8.0'
initialHeapPercent = 5;
maxHeapPercent = 100;
}
tasks.generateXmlConfig.dependsOn installer
tasks.build.dependsOn 'launch4j'
tasks.compileJava.enabled = false
tasks.reobfuscate.setProperty("extraSrg",["PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_10_R1"])
task signUniversal(type: SignJar, dependsOn: 'outputJar') {
onlyIf {
project.hasProperty('jarsigner')
}
def jarsigner = [:];
if (project.hasProperty('jarsigner'))
jarsigner = project.jarsigner;
alias = 'forge'
exclude "paulscode/**"
storePass = jarsigner.storepass
keyPass = jarsigner.keypass
keyStore = jarsigner.keystore
inputFile = outputJar.archivePath
outputFile = outputJar.archivePath
}
build.dependsOn signUniversal
installer.dependsOn signUniversal
outputJar {
classifier = 'universal'
manifest.attributes([
"Implementation-Title": "CraftBukkit",
"Implementation-Version": "CraftBukkit-1.10.2",
"Main-Class": "net.minecraftforge.fml.relauncher.ServerLaunchWrapper",
"TweakClass": "net.minecraftforge.fml.common.launcher.FMLTweaker",
"Class-Path": getServerClasspath(file("jsons/1.10.2-catserver-rel.json"))
])
}
processJson {
releaseJson = "jsons/1.10.2-catserver-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
"@project@": "CatServer",
"@artifact@": "luohuayu:project:${project.version}",
"@universal_jar@": { outputJar.archiveName },
"@timestamp@": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
extractForgeSources {
exclude "**/SideOnly.java", "**/Side.java"
}
genGradleProjects {
addCompileDep "junit:junit:4.12"
}
import groovy.json.JsonSlurper;
String getServerClasspath(File file) {
def node = new JsonSlurper().parse(file);
def out = new StringBuilder()
node.versionInfo.libraries.each { lib ->
if (lib.serverreq)
{
// group : artifact : version
def split = lib.name.split(':')
def group = split[0].replace('.', '/')
def artifact = split[1]
def version = split[2]
out += "libraries/$group/$artifact/$version/$artifact-${version}.jar "
}
}
out += "minecraft_server.${minecraft.version}.jar"
return out.toString();
}