Update to Gradle 9, Loom 1.15, EGT 0.7

This commit is contained in:
Jonas Herzig
2026-03-28 09:18:04 +01:00
parent f08607a599
commit b72fad4055
11 changed files with 52 additions and 42 deletions

View File

@@ -3,7 +3,7 @@ import gg.essential.gradle.util.*
plugins {
java
id("io.github.goooler.shadow") apply false
id("com.gradleup.shadow") apply false
id("gg.essential.multi-version")
id("gg.essential.defaults.repo")
id("gg.essential.defaults.java")
@@ -22,6 +22,7 @@ base.archivesName.set("replaymod")
java.withSourcesJar()
loom {
mixin.useLegacyMixinAp = true
mixin.defaultRefmapName.set("mixins.replaymod.refmap.json")
noServerRunConfigs()
}
@@ -318,9 +319,9 @@ val configureRelocation by tasks.registering {
}
val bundleJar by tasks.registering(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class) {
from(tasks.remapJar.flatMap { it.archiveFile })
from((if (platform.isUnobfuscated) tasks.jar else tasks.remapJar).flatMap { it.archiveFile }.map { zipTree(it) })
from(jGui.tasks.remapJar.flatMap { it.archiveFile }.map { zipTree(it) }) {
from((if (platform.isUnobfuscated) jGui.tasks.jar else jGui.tasks.remapJar).flatMap { it.archiveFile }.map { zipTree(it) }) {
filesMatching("mixins.jgui.json") {
filter { it.replace("de.johni0702", "com.replaymod.lib.de.johni0702") }
}
@@ -330,8 +331,8 @@ val bundleJar by tasks.registering(com.github.jengelman.gradle.plugins.shadow.ta
}
relocate("de.johni0702", "com.replaymod.lib.de.johni0702")
manifest.inheritFrom(tasks.jar.get().manifest)
from(shade)
manifest.from(tasks.jar.get().manifest)
from(shade.elements.map { it.map { zipTree(it) } })
configurations = listOf(shadow)
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class")

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
jGui

Submodule jGui updated: 985836c3d0...68de9e2d2a

View File

@@ -1,31 +1,42 @@
import groovy.json.JsonOutput
import java.io.ByteArrayOutputStream
import org.gradle.kotlin.dsl.support.serviceOf
import org.gradle.process.ExecOperations
plugins {
id("gg.essential.multi-version.root")
id("gg.essential.loom") version "1.7.35" apply false
id("gg.essential.loom") version "1.15.48" apply false
id("com.github.hierynomus.license") version "0.15.0"
}
val latestVersion = file("version.txt").readLines().first()
var releaseCommit = command("git", "blame", "-p", "-l", "version.txt").first().split(" ").first()
var releaseCommit = providers.exec {
commandLine("git", "blame", "-p", "-l", "version.txt")
}.standardOutput.asText.map { it.trim().split("/n").first().split(" ").first() }.get()
if (latestVersion == "2.1.0") { // First version since change from tag-based
releaseCommit = "35ac26e91689ac9bdf12dbb9902c452464a75108" // git rev-parse 1.12.2-2.1.0
}
val currentCommit = command("git", "rev-parse", "HEAD").first()
val currentCommit = providers.exec {
commandLine("git", "rev-parse", "HEAD")
}.standardOutput.asText.map { it.trim().split("/n").first() }.get()
if (releaseCommit == currentCommit) {
version = latestVersion
} else {
val diff = command("git", "log", "--format=oneline", "$releaseCommit..$currentCommit").size
val diff = providers.exec {
commandLine("git", "log", "--format=oneline", "$releaseCommit..$currentCommit")
}.standardOutput.asText.map { it.trim().split("/n").size }.get()
version = "$latestVersion-$diff-g${currentCommit.substring(0, 7)}"
}
if (gitDescribe().endsWith("*")) {
val dirty = providers.exec {
commandLine("git", "describe", "--always", "--dirty=*")
}.standardOutput.asText.map { it.trim().endsWith("*") }.get()
if (dirty) {
version = "$version-dirty"
}
group = "com.replaymod"
val bundleJar by tasks.creating(Copy::class) {
val bundleJar by tasks.registering(Copy::class) {
into("$buildDir/libs")
}
@@ -45,26 +56,15 @@ subprojects {
afterEvaluate {
val projectBundleJar = project.tasks.findByName("bundleJar")
if (projectBundleJar != null && projectBundleJar.hasProperty("archivePath") && project.name != "core") {
bundleJar.dependsOn(projectBundleJar)
bundleJar.from(projectBundleJar.withGroovyBuilder { getProperty("archivePath") })
bundleJar.configure {
dependsOn(projectBundleJar)
from(projectBundleJar.withGroovyBuilder { getProperty("archivePath") })
}
}
}
}
fun gitDescribe(): String {
try {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "describe", "--always", "--dirty=*")
standardOutput = stdout
}
return stdout.toString().trim()
} catch (e: Throwable) {
return "unknown"
}
}
fun command(vararg cmd: Any): List<String> {
fun ExecOperations.command(vararg cmd: String): List<String> {
val stdout = ByteArrayOutputStream()
exec {
commandLine(*cmd)
@@ -73,7 +73,10 @@ fun command(vararg cmd: Any): List<String> {
return stdout.toString().trim().split("\n")
}
fun generateVersionsJson(): Map<String, Any> {
fun generateVersionsJson(execOps: ExecOperations): Map<String, Any> {
fun command(vararg cmd: String): List<String> =
execOps.command(*cmd)
val versionComparator = compareBy<String>(
{ (it.split(".").getOrNull(0) ?: "0").toInt() },
{ (it.split(".").getOrNull(1) ?: "0").toInt() },
@@ -145,18 +148,24 @@ fun generateVersionsJson(): Map<String, Any> {
}
val writeVersionsJson by tasks.registering {
val execOps = project.serviceOf<ExecOperations>()
doLast {
val versionsRoot = generateVersionsJson()
val versionsRoot = generateVersionsJson(execOps)
val versionsJson = JsonOutput.prettyPrint(JsonOutput.toJson(versionsRoot))
File("versions.json").writeText(versionsJson)
}
}
val doRelease by tasks.registering {
val execOps = project.serviceOf<ExecOperations>()
doLast {
fun command(vararg cmd: String): List<String> =
execOps.command(*cmd)
// Parse version
val version = project.extra["releaseVersion"] as String
if (gitDescribe().endsWith("*")) {
if (command("git", "describe", "--always", "--dirty=*").first().endsWith("*")) {
throw InvalidUserDataException("Git working tree is dirty. Make sure to commit all changes.")
}
val (modVersion, preVersion) = if ("-b" in version) {
@@ -181,7 +190,7 @@ val doRelease by tasks.registering {
command("git", "commit", "-m", commitMessage)
// Generate versions.json content
val versionsRoot = generateVersionsJson()
val versionsRoot = generateVersionsJson(execOps)
val versionsJson = JsonOutput.prettyPrint(JsonOutput.toJson(versionsRoot))
// Switch to master branch to update versions.json
@@ -191,11 +200,11 @@ val doRelease by tasks.registering {
File("versions.json").writeText(versionsJson)
// Commit changes
project.exec { commandLine("git", "add", "versions.json") }
project.exec { commandLine("git", "commit", "-m", "Update versions.json for $version") }
command("git", "add", "versions.json")
command("git", "commit", "-m", "Update versions.json for $version")
// Return to previous branch
project.exec { commandLine("git", "checkout", "-") }
command("git", "checkout", "-")
}
}

View File

@@ -11,8 +11,8 @@ pluginManagement {
maven("https://repo.essential.gg/repository/maven-public")
}
plugins {
id("gg.essential.multi-version.root") version "0.6.7"
id("io.github.goooler.shadow") version "8.1.7"
id("gg.essential.multi-version.root") version "0.7.0-alpha.4"
id("com.gradleup.shadow") version "9.4.1"
}
}

View File

@@ -21,7 +21,7 @@ import net.minecraft.client.render.entity.LivingEntityRenderer;
//#endif
public abstract class MixinRenderLivingBase {
//#if MC>=11500
@Inject(method = "render", at = @At(
@Inject(method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(
//#else
//#if FABRIC>=1
//$$ @Inject(method = "render(Lnet/minecraft/entity/LivingEntity;DDDFF)V", at = @At(

View File

@@ -24,7 +24,7 @@ import static com.replaymod.core.versions.MCVer.*;
//#endif
public abstract class MixinRenderLivingBase {
//#if FABRIC>=1
@Inject(method = "hasLabel", at = @At("HEAD"), cancellable = true)
@Inject(method = "hasLabel(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true)
//#else
//$$ @Inject(method = "canRenderName(Lnet/minecraft/entity/LivingEntity;)Z", at = @At("HEAD"), cancellable = true)
//#endif
@@ -45,7 +45,7 @@ public abstract class MixinRenderLivingBase {
//#if MC>=12102
//$$ method = "updateRenderState(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;F)V",
//#elseif MC>=11500
method = "render",
method = "render(Lnet/minecraft/entity/LivingEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V",
//#else
//$$ method = "render(Lnet/minecraft/entity/LivingEntity;FFFFFF)V",
//#endif

View File

@@ -23,7 +23,7 @@ public class MixinTileEntityEndPortalRenderer {
static
//#else
//#if MC>=11400
//$$ @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Util;getMeasuringTimeMs()J"))
//$$ @Redirect(method = "render(Lnet/minecraft/block/entity/EndPortalBlockEntity;DDDFI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Util;getMeasuringTimeMs()J"))
//#else
//#if MC>=11200
//$$ @Redirect(method = "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityEndPortal;DDDFIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getSystemTime()J"))

View File

0
versions/1.20.4/.gitkeep Normal file
View File

0
versions/1.21.2/.gitkeep Normal file
View File