add 1.20.6 support

This commit is contained in:
CrazyDev22
2024-05-15 18:07:12 +02:00
parent 0dd6892b28
commit f92234297e
18 changed files with 878 additions and 41 deletions
+47 -18
View File
@@ -1,5 +1,3 @@
import java.util.function.Consumer
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
@@ -21,12 +19,12 @@ import java.util.function.Consumer
plugins {
id 'java'
id 'java-library'
id "com.github.johnrengelman.shadow" version "7.1.2"
id "io.github.goooler.shadow" version "8.1.7"
id "de.undercouch.download" version "5.0.1"
}
version '3.2.6-1.19.2-1.20.4'
def specialSourceVersion = '1.11.0' //[NMS]
def specialSourceVersion = '1.11.4' //[NMS]
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
// ======================== WINDOWS =============================
@@ -44,6 +42,7 @@ registerCustomOutputTaskUnix('PsychoLT', '/Volumes/PRO-G40/Minecraft/MinecraftDe
// ==============================================================
def NMS_BINDINGS = Map.of(
"v1_20_R4", "1.20.6-R0.1-SNAPSHOT",
"v1_20_R3", "1.20.4-R0.1-SNAPSHOT",
"v1_20_R2", "1.20.2-R0.1-SNAPSHOT",
"v1_20_R1", "1.20.1-R0.1-SNAPSHOT",
@@ -51,11 +50,15 @@ def NMS_BINDINGS = Map.of(
"v1_19_R2", "1.19.3-R0.1-SNAPSHOT",
"v1_19_R1", "1.19.2-R0.1-SNAPSHOT"
)
def JVM_VERSION = Map.of(
"v1_20_R4", 21,
)
NMS_BINDINGS.each {
def key = it.key
def value = it.value
def nms = value.split("-")[0];
project(":nms:${key}") {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'de.undercouch.download'
@@ -64,9 +67,10 @@ NMS_BINDINGS.each {
compileOnly "org.spigotmc:spigot-api:${value}"
compileOnly "org.bukkit:craftbukkit:${value}:remapped-mojang" //[NMS]
}
def buildToolsJar = new File(rootProject.buildDir, "tools/BuildTools.jar")
def specialSourceJar = new File(rootProject.buildDir, "tools/SpecialSource.jar")
def buildToolsJar = new File(rootProject.layout.buildDirectory.asFile.get(), "tools/BuildTools.jar")
def specialSourceJar = new File(rootProject.layout.buildDirectory.asFile.get(), "tools/SpecialSource.jar")
def buildDir = layout.buildDirectory.asFile.get();
def buildToolsFolder = new File(buildDir, "buildtools")
def specialSourceFolder = new File(buildDir, "specialsource")
def buildToolsHint = new File(buildDir, "buildtools/craftbukkit-" + nms + ".jar")
@@ -81,6 +85,22 @@ NMS_BINDINGS.each {
def m2s = m2.getAbsolutePath();
// ======================== Building Mapped Jars =============================
def targetJavaVersion = JVM_VERSION.getOrDefault(key, 17)
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
def javaLanguageVersion = JavaLanguageVersion.of(targetJavaVersion)
project.java.sourceCompatibility = javaVersion
project.java.targetCompatibility = javaVersion
project.java.toolchain.languageVersion = javaLanguageVersion
def launcher = javaToolchains.launcherFor(java.toolchain).get()
def javaHome = launcher.executablePath.getAsFile().parentFile.parentFile.getAbsolutePath()
tasks.withType(JavaCompile).configureEach {
options.release.set(targetJavaVersion)
}
tasks.withType(JavaExec).configureEach {
javaLauncher.set(launcher)
}
ext {
executeBuildTools = new Runnable() {
@@ -98,6 +118,7 @@ NMS_BINDINGS.each {
if (!buildToolsHint.exists()) {
buildToolsFolder.mkdirs()
project.javaexec {
executable = launcher.executablePath
classpath = files(buildToolsJar)
workingDir = buildToolsFolder
args = [
@@ -107,16 +128,14 @@ NMS_BINDINGS.each {
"craftbukkit",
"--remap"
]
def env = new HashMap(environment)
env.put("JAVA_HOME", javaHome)
environment = env
}
}
}
}
}
tasks.register("executeBuildTools") {
doLast {
property("executeBuildTools").run();
}
}
tasks.build.doLast {
//Download
@@ -136,6 +155,7 @@ NMS_BINDINGS.each {
//obfuscate
javaexec {
executable = launcher.executablePath
workingDir = specialSourceFolder
classpath = files(specialSourceJar,
new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-mojang.jar"))
@@ -150,10 +170,14 @@ NMS_BINDINGS.each {
m2s + "/org/spigotmc/minecraft-server/" + value + "/minecraft-server-" + value + "-maps-mojang.txt",
"--reverse",
]
def env = new HashMap(environment)
env.put("JAVA_HOME", javaHome)
environment = env
}
//remap
javaexec {
executable = launcher.executablePath
workingDir = specialSourceFolder
classpath = files(specialSourceJar,
new File(m2s + "/org/spigotmc/spigot/" + value + "/spigot-" + value + "-remapped-obf.jar"))
@@ -167,6 +191,9 @@ NMS_BINDINGS.each {
"-m",
m2s + "/org/spigotmc/minecraft-server/" + value + "/minecraft-server-" + value + "-maps-spigot.csrg"
]
def env = new HashMap(environment)
env.put("JAVA_HOME", javaHome)
environment = env
}
//copy
copy {
@@ -181,7 +208,10 @@ NMS_BINDINGS.each {
}
shadowJar {
NMS_BINDINGS.each {dependsOn(":nms:${it.key}:build")}
NMS_BINDINGS.each {
dependsOn(":nms:${it.key}:build")
from("${project(":nms:${it.key}").layout.buildDirectory.asFile.get()}/libs/${it.key}.jar")
}
//minimize()
append("plugin.yml")
@@ -193,9 +223,6 @@ shadowJar {
dependencies {
implementation project(':core')
NMS_BINDINGS.each {
implementation project(":nms:${it.key}")
}
}
configurations.configureEach {
@@ -284,8 +311,8 @@ if (JavaVersion.current().toString() != "17") {
task iris(type: Copy) {
group "iris"
from new File(buildDir, "libs/Iris-${version}.jar")
into buildDir
from new File(layout.buildDirectory.asFile.get(), "libs/Iris-${version}.jar")
into layout.buildDirectory.asFile.get()
dependsOn(build)
}
@@ -308,7 +335,9 @@ NMS_BINDINGS.keySet().forEach {
tasks.register("setup-${nms}") {
group "iris"
dependsOn(":nms:${nms}:clean")
dependsOn(":nms:${nms}:executeBuildTools")
doLast {
project(":nms:${nms}").property("executeBuildTools").run();
}
}
}