From bfe4b00e782ec9a89c5ae49a47d9b759d2cb650b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=AB=E3=82=83=E3=82=93=E3=81=A1=E3=82=83=E3=82=93?= Date: Fri, 17 Jan 2025 15:47:07 +0800 Subject: [PATCH] Update build scripts (#156) * Update dependency gradle to v8.11.1 * Update dependency org.projectlombok:lombok to v1.18.36 * Update plugin me.fallenbreath.yamlang to v1.4.1 * Update plugin org.ajoberstar.grgit to v5.3.0 * Update plugin architectury-loom to 1.9-SNAPSHOT * Update plugin com.replaymod.preprocess to 9d21b33 * Using root project as project graph root node * Move build.gradle to the real project graph root node * Set mapping for each node on project graph, even if it is empty --------- Signed-off-by: Hendrix-Shen --- build.gradle | 30 ++++++++++--------- gradle.properties | 10 +++---- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 17 +++++++++-- .../build.gradle | 29 ++---------------- versions/mapping-1.21.1-fabric-neoforge.txt | 0 versions/mapping-fabric-1.15.2-1.14.4.txt | 1 + versions/mapping-fabric-1.15.2-1.16.5.txt | 1 - versions/mapping-fabric-1.16.5-1.15.2.txt | 1 + versions/mapping-fabric-1.16.5-1.17.1.txt | 0 versions/mapping-fabric-1.17.1-1.18.2.txt | 0 versions/mapping-fabric-1.18.2-1.19.2.txt | 0 versions/mapping-fabric-1.19.3-1.19.4.txt | 0 versions/mapping-fabric-1.19.4-1.20.1.txt | 0 versions/mapping-fabric-1.20.1-1.20.2.txt | 0 versions/mapping-fabric-1.20.2-1.20.4.txt | 0 versions/mapping-fabric-1.20.4-1.20.6.txt | 0 versions/mapping-fabric-1.20.6-1.21.1.txt | 0 versions/mapping-fabric-1.21.1-1.21.3.txt | 0 versions/mapping-fabric-1.21.3-1.21.4.txt | 0 20 files changed, 42 insertions(+), 49 deletions(-) rename versions/{1.14.4-fabric => 1.16.5-fabric}/build.gradle (94%) create mode 100644 versions/mapping-1.21.1-fabric-neoforge.txt create mode 100644 versions/mapping-fabric-1.15.2-1.14.4.txt delete mode 100644 versions/mapping-fabric-1.15.2-1.16.5.txt create mode 100644 versions/mapping-fabric-1.16.5-1.15.2.txt create mode 100644 versions/mapping-fabric-1.16.5-1.17.1.txt create mode 100644 versions/mapping-fabric-1.17.1-1.18.2.txt create mode 100644 versions/mapping-fabric-1.18.2-1.19.2.txt create mode 100644 versions/mapping-fabric-1.19.3-1.19.4.txt create mode 100644 versions/mapping-fabric-1.19.4-1.20.1.txt create mode 100644 versions/mapping-fabric-1.20.1-1.20.2.txt create mode 100644 versions/mapping-fabric-1.20.2-1.20.4.txt create mode 100644 versions/mapping-fabric-1.20.4-1.20.6.txt create mode 100644 versions/mapping-fabric-1.20.6-1.21.1.txt create mode 100644 versions/mapping-fabric-1.21.1-1.21.3.txt create mode 100644 versions/mapping-fabric-1.21.3-1.21.4.txt diff --git a/build.gradle b/build.gradle index 6b2da2f6..942503d4 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,8 @@ plugins { } preprocess { + strictExtraMappings.set(false) + // Fabric Node mc11404_fabric = createNode("1.14.4-fabric", 1_14_04, "mojang") Node mc11502_fabric = createNode("1.15.2-fabric", 1_15_02, "mojang") @@ -25,24 +27,24 @@ preprocess { Node mc12103_fabric = createNode("1.21.3-fabric", 1_21_03, "mojang") Node mc12104_fabric = createNode("1.21.4-fabric", 1_21_04, "mojang") - mc11404_fabric.link(mc11502_fabric, null) - mc11502_fabric.link(mc11605_fabric, file("versions/mapping-fabric-1.15.2-1.16.5.txt")) - mc11605_fabric.link(mc11701_fabric, null) - mc11701_fabric.link(mc11802_fabric, null) - mc11802_fabric.link(mc11902_fabric, null) + mc11502_fabric.link(mc11404_fabric, file("versions/mapping-fabric-1.15.2-1.14.4.txt")) + mc11605_fabric.link(mc11502_fabric, file("versions/mapping-fabric-1.16.5-1.15.2.txt")) + mc11605_fabric.link(mc11701_fabric, file("versions/mapping-fabric-1.16.5-1.17.1.txt")) + mc11701_fabric.link(mc11802_fabric, file("versions/mapping-fabric-1.17.1-1.18.2.txt")) + mc11802_fabric.link(mc11902_fabric, file("versions/mapping-fabric-1.18.2-1.19.2.txt")) mc11902_fabric.link(mc11903_fabric, file("versions/mapping-fabric-1.19.2-1.19.3.txt")) - mc11903_fabric.link(mc11904_fabric, null) - mc11904_fabric.link(mc12001_fabric, null) - mc12001_fabric.link(mc12002_fabric, null) - mc12002_fabric.link(mc12004_fabric, null) - mc12004_fabric.link(mc12006_fabric, null) - mc12006_fabric.link(mc12101_fabric, null) - mc12101_fabric.link(mc12103_fabric, null) - mc12103_fabric.link(mc12104_fabric, null) + mc11903_fabric.link(mc11904_fabric, file("versions/mapping-fabric-1.19.3-1.19.4.txt")) + mc11904_fabric.link(mc12001_fabric, file("versions/mapping-fabric-1.19.4-1.20.1.txt")) + mc12001_fabric.link(mc12002_fabric, file("versions/mapping-fabric-1.20.1-1.20.2.txt")) + mc12002_fabric.link(mc12004_fabric, file("versions/mapping-fabric-1.20.2-1.20.4.txt")) + mc12004_fabric.link(mc12006_fabric, file("versions/mapping-fabric-1.20.4-1.20.6.txt")) + mc12006_fabric.link(mc12101_fabric, file("versions/mapping-fabric-1.20.6-1.21.1.txt")) + mc12101_fabric.link(mc12103_fabric, file("versions/mapping-fabric-1.21.1-1.21.3.txt")) + mc12103_fabric.link(mc12104_fabric, file("versions/mapping-fabric-1.21.3-1.21.4.txt")) // NeoForge Node mc12101_neoforge = createNode("1.21.1-neoforge", 1_21_01, "mojang") - mc12101_fabric.link(mc12101_neoforge, null) + mc12101_fabric.link(mc12101_neoforge, file("versions/mapping-1.21.1-fabric-neoforge.txt")) } ext { diff --git a/gradle.properties b/gradle.properties index f86dbfa3..a6a83862 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,14 +16,14 @@ mod.version=4.0 # Dependency Versions ## Annotation processor -dependencies.lombok_version=1.18.34 +dependencies.lombok_version=1.18.36 ## MagicLib dependencies.magiclib_dependency=0.8.655 dependencies.magiclib_version=0.8.655-beta # Gradle Plugins -architectury_loom_version=1.7-SNAPSHOT -grgit_version=5.2.2 -preprocessor_version=ce1aeb2b +architectury_loom_version=1.9-SNAPSHOT +grgit_version=5.3.0 +preprocessor_version=9d21b33 replace_token_version=1.1.2 -yamlang_version=1.4.0 +yamlang_version=1.4.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 79eb9d00..c1d5e018 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index d63d8172..f6016398 100644 --- a/settings.gradle +++ b/settings.gradle @@ -48,9 +48,22 @@ Map> settings = file("settings.json").withReader { new JsonSlurper().parse(it) as Map> } -for (String version : settings.get("versions")) { +List versions = settings.get("versions") as List +File mainProjectFile = file("versions/mainProject") + +if (!mainProjectFile.exists()) { + throw new IllegalArgumentException("Missing mainProject file: ${mainProjectFile.absolutePath}") +} + +String mainProject = new String(mainProjectFile.readBytes()).trim() + +if (!versions.contains(mainProject)) { + throw new IllegalArgumentException("Invalid main project: ${mainProject}") +} + +for (String version : versions) { include(":$version") ProjectDescriptor proj = project(":$version") proj.setProjectDir(file("versions/$version")) - proj.setBuildFileName("../${settings.versions.get(0)}/build.gradle") + proj.setBuildFileName("../${mainProject}/build.gradle") } diff --git a/versions/1.14.4-fabric/build.gradle b/versions/1.16.5-fabric/build.gradle similarity index 94% rename from versions/1.14.4-fabric/build.gradle rename to versions/1.16.5-fabric/build.gradle index 9297916b..1199cb4b 100644 --- a/versions/1.14.4-fabric/build.gradle +++ b/versions/1.16.5-fabric/build.gradle @@ -1,6 +1,3 @@ -import java.util.regex.Matcher -import java.util.regex.Pattern - plugins { id("maven-publish") @@ -149,7 +146,6 @@ dependencies { } loom { - // accessWidenerPath.set(file("src/main/resources/${project.parent.property("mod.id")}.accesswidener")) enableTransitiveAccessWideners.set(false) interfaceInjection { @@ -157,13 +153,6 @@ loom { isEnabled.set(false) } - if (modPlatform == "forge") { - forge { - convertAccessWideners.set(true) - mixinConfig("${project.parent.property("mod.id")}.mixins.json") - } - } - runConfigs.configureEach { // Dump modified classes automatically. property("mixin.debug.export", "true") @@ -214,8 +203,8 @@ loom { defaultCharacterEncoding("UTF-8") doFirst { - file("${projectDir}/run/client/config").mkdirs() - file("${projectDir}/run/client/options.txt").with { File f -> + file("${project.projectDir}/run/client/config").mkdirs() + file("${project.projectDir}/run/client/options.txt").with { File f -> { if (!f.exists()) { f.parentFile.mkdirs() @@ -243,7 +232,7 @@ loom { doFirst { // Agree eula before server init. - file("${projectDir}/run/server/eula.txt").with { File f -> + file("${project.projectDir}/run/server/eula.txt").with { File f -> { if (!f.exists()) { f.parentFile.mkdirs() @@ -283,18 +272,6 @@ java { withSourcesJar() } -remapJar { - if (forgeLike) { - if (modPlatform == "neoforge") { - // atAccessWideners.add("${project.parent.property("mod.id")}.accesswidener") - } - - exclude("${project.parent.property("mod.id")}.accesswidener") - } - - setRemapperIsolation(true) -} - replaceToken { targetSourceSets.set([sourceSets.main]) replace("@MOD_IDENTIFIER@", project.parent.property("mod.id").toString().replace("-", "_")) diff --git a/versions/mapping-1.21.1-fabric-neoforge.txt b/versions/mapping-1.21.1-fabric-neoforge.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.15.2-1.14.4.txt b/versions/mapping-fabric-1.15.2-1.14.4.txt new file mode 100644 index 00000000..68587b74 --- /dev/null +++ b/versions/mapping-fabric-1.15.2-1.14.4.txt @@ -0,0 +1 @@ +com.mojang.serialization.Dynamic com.mojang.datafixers.Dynamic \ No newline at end of file diff --git a/versions/mapping-fabric-1.15.2-1.16.5.txt b/versions/mapping-fabric-1.15.2-1.16.5.txt deleted file mode 100644 index 8c96ca6a..00000000 --- a/versions/mapping-fabric-1.15.2-1.16.5.txt +++ /dev/null @@ -1 +0,0 @@ -com.mojang.datafixers.Dynamic com.mojang.serialization.Dynamic \ No newline at end of file diff --git a/versions/mapping-fabric-1.16.5-1.15.2.txt b/versions/mapping-fabric-1.16.5-1.15.2.txt new file mode 100644 index 00000000..68587b74 --- /dev/null +++ b/versions/mapping-fabric-1.16.5-1.15.2.txt @@ -0,0 +1 @@ +com.mojang.serialization.Dynamic com.mojang.datafixers.Dynamic \ No newline at end of file diff --git a/versions/mapping-fabric-1.16.5-1.17.1.txt b/versions/mapping-fabric-1.16.5-1.17.1.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.17.1-1.18.2.txt b/versions/mapping-fabric-1.17.1-1.18.2.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.18.2-1.19.2.txt b/versions/mapping-fabric-1.18.2-1.19.2.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.19.3-1.19.4.txt b/versions/mapping-fabric-1.19.3-1.19.4.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.19.4-1.20.1.txt b/versions/mapping-fabric-1.19.4-1.20.1.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.20.1-1.20.2.txt b/versions/mapping-fabric-1.20.1-1.20.2.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.20.2-1.20.4.txt b/versions/mapping-fabric-1.20.2-1.20.4.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.20.4-1.20.6.txt b/versions/mapping-fabric-1.20.4-1.20.6.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.20.6-1.21.1.txt b/versions/mapping-fabric-1.20.6-1.21.1.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.21.1-1.21.3.txt b/versions/mapping-fabric-1.21.1-1.21.3.txt new file mode 100644 index 00000000..e69de29b diff --git a/versions/mapping-fabric-1.21.3-1.21.4.txt b/versions/mapping-fabric-1.21.3-1.21.4.txt new file mode 100644 index 00000000..e69de29b