forked from KettleFoundation/Kettle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
253 lines (224 loc) · 6.85 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
241
242
243
244
245
246
247
248
249
250
251
252
253
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://jcenter.bintray.com"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3+'
classpath 'net.nemerosa:versioning:2.7.1'
classpath "gradle.plugin.com.github.breadmoirai:github-release:2.2.4"
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "idea"
apply plugin: 'net.minecraftforge.gradle.patcher'
apply plugin: 'net.minecraftforge.gradle.launch4j'
apply plugin: 'net.nemerosa.versioning'
apply plugin: "com.github.breadmoirai.github-release"
group 'kettlefoundation'
version 'git-' + versioning.info.branch + "-" + versioning.info.build
repositories {
clear()
mavenCentral()
maven {
name = "forge"
url = "https://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 'maven'
url 'https://mvnrepository.com/artifact/'
}
maven {
name 'KettleFoundation'
url 'https://repo.hexeption.co.uk/artifactory/Kettle/'
}
flatDir {
dirs 'src/main/resources'
}
}
configurations{
compile.extendsFrom exported
libraries
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile(group: 'bukkit', name: 'bukkit', version: '1.12.2-R0.1')
}
jar{
into('lib') {
from configurations.libraries
}
exclude "**/configurations/**"
exclude "**/META-INF/**"
exclude "log4j2.xml"
}
minecraft {
version = "1.12.2"
mappings = "snapshot_nodoc_20171003"
workspaceDir = "projects"
versionJson = "jsons/1.12.2-dev.json"
buildUserdev = true
buildInstaller = false
installerVersion = "1.5"
def common = {
patchPrefixOriginal "../src-base/minecraft"
patchPrefixChanged "../src-work/minecraft"
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
}
kettle {
rootDir "."
patchDir "patches/"
patchAfter "forge"
genPatchesFrom "forge"
genMcpPatches = true
applyMcpPatches = true
s2sKeepImports = true
with common
}
}
}
sourceCompatibility = 1.8
tasks.generateXmlConfig.dependsOn installer
tasks.compileJava.enabled = false
tasks.build.dependsOn 'launch4j'
tasks.reobfuscate.setProperty("extraSrg",["PK: org/bukkit/craftbukkit org/bukkit/craftbukkit/v1_12_R1"])
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.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
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": "Kettle",
"Implementation-Version": version,
"Main-Class": "net.minecraftforge.fml.relauncher.ServerLaunchWrapper",
"TweakClass": "net.minecraftforge.fml.common.launcher.FMLTweaker",
"Class-Path": getServerClasspath(file("jsons/1.12.2-rel.json"))
])
}
processJson {
releaseJson = "jsons/1.12.2-rel.json"
addReplacements([
"@minecraft_version@": project.minecraft.version,
"@version@": project.version,
"@project@": "kettle",
"@artifact@": "kf:kettle:${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 "bukkit:bukkit:1.12.2-R0.1"
addRepo("KettleFoundation", "https://repo.hexeption.co.uk/artifactory/Kettle/")
}
import groovy.json.JsonSlurper
import java.util.stream.Collectors
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.1.12.2.jar"
return out.toString()
}
githubRelease {
if(System.getenv("GITHUB_TOKEN") != null){
token System.getenv("GITHUB_TOKEN")
}else{
token ""
}
owner "KettleFoundation"
repo "Kettle"
releaseName "Kettle Dev " + versioning.info.branch + "-" + versioning.info.build
body {
"""\
## Setup Info
Don't forget to download [Minecraft Server 1.12.2](https://launcher.mojang.com/mc/game/1.12.2/server/886945bfb2b978778c3a0288fd7fab09d315b25f/server.jar)
(Rename it to `minecraft_server.1.12.2.jar`)
${(changelog().call().readLines().stream().map { "- $it" }.collect(Collectors.joining('\n', '## Changelog\n', '')))}
"""
}
prerelease true
draft true
releaseAssets = [
fileTree("build/distributions/").filter { it.name.endsWith("jar") || it.name.endsWith("zip") },
fileTree("/release/").filter { it.name.endsWith("zip") }
]
}