-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
222 lines (196 loc) · 7.1 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://files.minecraftforge.net/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public/' }
maven { url 'https://raw.githubusercontent.com/PFCraft/MohistCentral/master/repository' }
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'net.nemerosa:versioning:2.7.1'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'net.minecraftforge.gradle.launch4j'
apply plugin: 'net.nemerosa.versioning'
group = 'red.mohist'
version = versioning {
full {it.abbreviated}
dirty = { t -> t }
}.info.full
repositories {
clear()
mavenCentral()
maven { url 'https://files.minecraftforge.net/maven' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
maven { url 'https://libraries.minecraft.net/' }
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public/' }
maven { url 'https://raw.githubusercontent.com/PFCraft/MohistCentral/master/repository' }
maven { url 'http://repo.spongepowered.org/maven'
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
configurations.all {
transitive = false
}
dependencies {
// 以下库仅仅是为了让开发人员更好地开发
// 以下庫僅僅是為了讓開發人員更好地開發
// The following libraries are just for better development by developers
// 以下のライブラリは開発者がより良い開発をするためだけです
implementation 'org.apache.commons:commons-lang3:3.5'
implementation 'commons-io:commons-io:2.5'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'com.mojang:authlib:1.5.25'
implementation 'com.mojang:realms:1.10.22'
implementation 'org.apache.commons:commons-compress:1.8.1'
implementation 'org.apache.httpcomponents:httpclient:4.3.3'
implementation 'commons-logging:commons-logging:1.1.3'
implementation 'org.apache.httpcomponents:httpcore:4.3.2'
implementation 'it.unimi.dsi:fastutil:7.1.0'
implementation 'org.apache.logging.log4j:log4j-core:2.8.1'
implementation 'jline:jline:2.13'
implementation 'org.ow2.asm:asm-debug-all:5.2'
implementation 'net.sf.trove4j:trove4j:3.0.3'
implementation 'org.yaml:snakeyaml:1.19'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'commons-lang:commons-lang:2.6'
implementation 'net.md-5:SpecialSource:1.8.5'
implementation 'org.xerial:sqlite-jdbc:3.21.0.1'
implementation 'mysql:mysql-connector-java:5.1.46'
implementation 'net.md-5:bungeecord-chat:1.12-SNAPSHOT'
implementation 'org.spongepowered:mixin:0.7.10-SNAPSHOT'
implementation 'io.netty:netty-all:4.1.38.Final'
}
minecraft.version = "1.12.2"
minecraft {
mappings = 'snapshot_nodoc_20171003'
workspaceDir = "projects"
versionJson = "jsons/${minecraft.version}-mohist-dev.json"
buildUserdev = false
buildInstaller = true
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
with common
}
mohist {
rootDir "."
patchDir "patches/"
patchAfter "forge"
genPatchesFrom "forge"
genMcpPatches = true
applyMcpPatches = true
s2sKeepImports = true
with common
}
}
}
sourceCompatibility = 1.8
tasks.generateXmlConfig.dependsOn installer
tasks.build.dependsOn 'launch4j'
installer {
classifier = 'installer'
from "src/main/resources/mohist_logo.png"
rename "mohist_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
}
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
}
uploadArchives.dependsOn signUniversal
build.dependsOn signUniversal
installer.dependsOn signUniversal
outputJar {
classifier = 'server'
manifest.attributes([
"Implementation-Title": "Mohist",
"Implementation-Version": version,
"Main-Class": "red.mohist.Mohist",
"TweakClass": "net.minecraftforge.fml.common.launcher.FMLTweaker",
"Class-Path": getServerClasspath(file("jsons/${minecraft.version}-mohist-rel.json"))
])
}
processJson {
releaseJson = "jsons/${minecraft.version}-mohist-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
"@project@": "mohist",
"@artifact@": "red.mohist:mohist:${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"
addCompileDep "org.junit.jupiter:junit-jupiter-api:5.0.0"
addCompileDep "org.opentest4j:opentest4j:1.0.0" // needed for junit 5
addCompileDep "org.hamcrest:hamcrest-core:1.3"
}
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)
{
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()
}
task dumpLibs(type: Copy) {
into "$buildDir/libs/libraries"
from configurations.compile
}