fix remapping not working

This commit is contained in:
CrazyDev22 committed 2023-12-16 18:40:53 +01:00
1 parent 91ec6b773d
commit 350328f99c
1 file changed
+41 -39
+41 -39
View File
@@ -1,3 +1,5 @@
import java.util.function.Consumer
/* /*
* Iris is a World Generator for Minecraft Bukkit Servers * Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software) * Copyright (c) 2021 Arcane Arts (Volmit Software)
@@ -80,29 +82,19 @@ NMS_BINDINGS.each {
def m2s = m2.getAbsolutePath(); def m2s = m2.getAbsolutePath();
// ======================== Building Mapped Jars ============================= // ======================== Building Mapped Jars =============================
Runnable downloadBuildtools = () -> { Runnable executeBuildTools = () -> {
//Download
if (!buildToolsJar.exists()) { if (!buildToolsJar.exists()) {
download.run { download.run {
src 'https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar' src 'https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar'
dest buildToolsJar dest buildToolsJar
} }
} }
}
Runnable downloadSpecialSource = () -> { //Execute
if (!specialSourceJar.exists()) {
download.run {
src 'https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/' + specialSourceVersion + '/SpecialSource-'+specialSourceVersion+'-shaded.jar'
dest specialSourceJar
}
}
}
Runnable executeBuildTools = () -> {
if (!buildToolsHint.exists()) { if (!buildToolsHint.exists()) {
downloadBuildtools.run()
buildToolsFolder.mkdirs() buildToolsFolder.mkdirs()
javaexec { project.javaexec {
classpath = files(buildToolsJar) classpath = files(buildToolsJar)
workingDir = buildToolsFolder workingDir = buildToolsFolder
args = [ args = [
@@ -116,27 +108,24 @@ NMS_BINDINGS.each {
} }
} }
tasks.register("executeBuildTools") { Consumer<File> specialSourceRemap = outputFile -> {
doFirst { //Download
executeBuildTools.run() if (!specialSourceJar.exists()) {
download.run {
src 'https://repo.maven.apache.org/maven2/net/md-5/SpecialSource/' + specialSourceVersion + '/SpecialSource-'+specialSourceVersion+'-shaded.jar'
dest specialSourceJar
} }
} }
tasks.register("copyBuildToSpecialSource", Copy) {
doFirst {
downloadSpecialSource.run()
specialSourceFolder.mkdirs(); specialSourceFolder.mkdirs();
}
group "remapping" //Copy
from outputJar project.copy {
from outputFile
into specialSourceFolder into specialSourceFolder
dependsOn(jar)
} }
tasks.register("specialSourceRemapObfuscate", JavaExec) { //obfuscate
group "remapping" project.javaexec {
dependsOn(copyBuildToSpecialSource)
workingDir = specialSourceFolder workingDir = specialSourceFolder
classpath = files(specialSourceJar, classpath = files(specialSourceJar,
new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-mojang.jar")) new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-mojang.jar"))
@@ -153,9 +142,8 @@ NMS_BINDINGS.each {
] ]
} }
tasks.register("specialSourceRemap", JavaExec) { //remap
group "remapping" project.javaexec {
dependsOn(specialSourceRemapObfuscate)
workingDir = specialSourceFolder workingDir = specialSourceFolder
classpath = files(specialSourceJar, classpath = files(specialSourceJar,
new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-obf.jar")) new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-obf.jar"))
@@ -170,15 +158,26 @@ NMS_BINDINGS.each {
m2s + "/org/spigotmc/minecraft-server/" + value + "/minecraft-server-" + value + "-maps-spigot.csrg" m2s + "/org/spigotmc/minecraft-server/" + value + "/minecraft-server-" + value + "-maps-spigot.csrg"
] ]
} }
//copy
tasks.register("copySpecialSourceToBuild", Copy) { project.copy {
group "remapping"
from ssJar from ssJar
into outputJar.getParentFile() into outputFile.getParentFile()
rename { rename {
outputJar.getName() outputFile.getName()
}
}
}
tasks.register("executeBuildTools") {
doFirst {
executeBuildTools.run()
}
}
tasks.register("specialSourceRemap", JavaExec) {
doFirst {
specialSourceRemap.accept(outputJar)
} }
dependsOn(specialSourceRemap)
} }
shadowJar { shadowJar {
@@ -187,10 +186,13 @@ NMS_BINDINGS.each {
relocate('io.papermc.lib', 'com.volmit.iris.util.paper') relocate('io.papermc.lib', 'com.volmit.iris.util.paper')
relocate('net.kyori', 'com.volmit.iris.util.kyori') relocate('net.kyori', 'com.volmit.iris.util.kyori')
archiveFileName.set("Iris-${project.name}.jar") archiveFileName.set("Iris-${project.name}.jar")
doLast {
specialSourceRemap.accept(archiveFile.get().asFile)
}
} }
tasks.build.dependsOn(copySpecialSourceToBuild) tasks.build.dependsOn(specialSourceRemap)
tasks.shadowJar.dependsOn(build)
executeBuildTools.run() executeBuildTools.run()
} }
} }