Skip to content

Commit

Permalink
LWJGL 3.3.2 stable update (#58)
Browse files Browse the repository at this point in the history
* Add png imageio internal plugin open-module

* Switch dev to lwjgl 3.3.2 stable

* Update lwjgl to 3.3.2 stable in the multimc patches

* Update buildscript

* Deduplicate java args between gradle and mmc-patches
  • Loading branch information
eigenraven authored Apr 18, 2023
1 parent 558ccc8 commit 807cca2
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 236 deletions.
48 changes: 26 additions & 22 deletions addon.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ def newJavaToolchainSpec = new DefaultToolchainSpec(objects)
newJavaToolchainSpec.vendor.set(JvmVendorSpec.AZUL)
newJavaToolchainSpec.languageVersion.set(JavaLanguageVersion.of(17))

def extraJavaArgs = [
"--illegal-access=warn",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.text=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-opens", "java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED",
"--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules", "java.sql.rowset",
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED",
]

SourceSet forgePatchesSet
SourceSet hotswapSet

Expand Down Expand Up @@ -108,7 +131,8 @@ def mmcInstanceFilesZip = tasks.register("mmcInstanceFiles", Zip) {
from(new File(projectDir, "prism-libraries/"))
exclude("forgepatches-for-dev-work.json", "META-INF", "META-INF/**")
filesMatching(["mmc-pack.json", "patches/me.eigenraven.lwjgl3ify.forgepatches.json"]) {
expand "version": project.version
expand "version": project.version,
"jvmArgs": extraJavaArgs.collect { '"' + it + '"' }.join(", ")
}
}

Expand Down Expand Up @@ -143,27 +167,7 @@ afterEvaluate {

def newJavaLauncher = javaToolchains.launcherFor(newJavaToolchainSpec)

minecraft.extraRunJvmArguments.addAll(
"--illegal-access=warn",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.text=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules", "java.sql.rowset",
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
)
minecraft.extraRunJvmArguments.addAll(extraJavaArgs)

for (runTask in ["runClient", "runServer"]) {
tasks.named(runTask, JavaExec).configure {
Expand Down
120 changes: 27 additions & 93 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1679836390
//version: 1681680742
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -67,20 +67,21 @@ plugins {
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
id 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.3.0'
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
id 'com.diffplug.spotless' version '6.7.2' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.2.3'
id 'com.gtnewhorizons.retrofuturagradle' version '1.2.5'
}
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.")

if (project.file('.git/HEAD').isFile()) {
// In submodules, .git is a file pointing to the real git dir
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
apply plugin: 'com.palantir.git-version'
}

Expand Down Expand Up @@ -201,6 +202,14 @@ configurations {
canBeConsumed = false
canBeResolved = false
}

create("devOnlyNonPublishable") {
description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)"
canBeConsumed = false
canBeResolved = false
}
compileOnly.extendsFrom(devOnlyNonPublishable)
runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable)
}

if (enableModernJavaSyntax.toBoolean()) {
Expand Down Expand Up @@ -405,8 +414,6 @@ minecraft {
extraRunJvmArguments.add("-ea:${modGroup}")

if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")

if (usesMixinDebug.toBoolean()) {
extraRunJvmArguments.addAll([
"-Dmixin.debug.countInjections=true",
Expand Down Expand Up @@ -561,8 +568,9 @@ repositories {

def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.5"
def mixinProviderSpec = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"

dependencies {
if (usesMixins.toBoolean()) {
Expand All @@ -574,8 +582,10 @@ dependencies {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
if (usesMixins.toBoolean()) {
implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
}
}

Expand All @@ -591,10 +601,11 @@ pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpec) withoutClassifier() because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpec) withoutClassifier() because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpec) withoutClassifier() because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpec) withoutClassifier() because("Unimixins replaces other mixin mods")
substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:Mixingasm') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
}
}

Expand Down Expand Up @@ -809,10 +820,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
}
this.classpath(project.java17DependenciesCfg)

if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) {
this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker")
}
}
}

Expand Down Expand Up @@ -1390,7 +1397,7 @@ static int replaceParams(File file, Map<String, String> params) {
return 0
}

// Dependency Deobfuscation
// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)

def deobf(String sourceURL) {
try {
Expand Down Expand Up @@ -1432,97 +1439,24 @@ def deobfMaven(String repoURL, String mavenDep) {
}

def deobfCurse(String curseDep) {
try {
return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
} catch (Exception ignored) {
out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
}
return dependencies.rfg.deobf("curse.maven:$curseDep")
}

// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
String bon2Dir = "$cacheDir/forge_gradle/deobf"
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"

if (file(deobfFile).exists()) {
return files(deobfFile)
}

String mappingsVer
String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
if (remoteMappings) {
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"

zipMappings(mappingsZIP, remoteMappings, bon2Dir)

mappingsVer = "snapshot_$id"
} else {
mappingsVer = "${channel}_$mappingsVersion"
}

download.run {
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
dest bon2File
quiet true
overwrite false
}

download.run {
src sourceURL
dest obfFile
quiet true
overwrite false
}

exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}

return files(deobfFile)
return dependencies.rfg.deobf(files(obfFile))
}

def zipMappings(String zipPath, String url, String bon2Dir) {
File zipFile = new File(zipPath)
if (zipFile.exists()) {
return
}

String fieldsCache = "$bon2Dir/data/fields.csv"
String methodsCache = "$bon2Dir/data/methods.csv"

download.run {
src "${url}fields.csv"
dest fieldsCache
quiet true
}
download.run {
src "${url}methods.csv"
dest methodsCache
quiet true
}

zipFile.getParentFile().mkdirs()
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))

zos.putNextEntry(new ZipEntry("fields.csv"))
Files.copy(Paths.get(fieldsCache), zos)
zos.closeEntry()

zos.putNextEntry(new ZipEntry("methods.csv"))
Files.copy(Paths.get(methodsCache), zos)
zos.closeEntry()

zos.close()
}

// Helper methods

def checkPropertyExists(String propertyName) {
Expand Down
26 changes: 13 additions & 13 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

minecraft {
mainLwjglVersion = 3
lwjgl3Version = "3.3.2-SNAPSHOT"
lwjgl3Version = "3.3.2"
}

def addGtForTesting = false
Expand Down Expand Up @@ -30,19 +30,19 @@ dependencies {

runtimeOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.3.39-GTNH:dev')
if (addGtForTesting) {
runtimeOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.265:dev')
runtimeOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-153-GTNH:dev")
runtimeOnly("com.github.GTNewHorizons:Chisel:2.10.16-GTNH:dev")
runtimeOnly("com.github.GTNewHorizons:ForestryMC:4.5.6:dev")
runtimeOnly("com.github.GTNewHorizons:Railcraft:9.13.14:dev")
runtimeOnly("com.github.GTNewHorizons:EnderIO:2.3.1.54:dev")
runtimeOnly("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { transitive = false }
runtimeOnly("com.github.GTNewHorizons:MrTJPCore:1.1.4:dev")
runtimeOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.1:dev")
runtimeOnly("com.github.GTNewHorizons:ForgeRelocation:0.0.3:dev")
runtimeOnlyNonPublishable('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.265:dev')
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-153-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Chisel:2.10.16-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForestryMC:4.5.6:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.13.14:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderIO:2.3.1.54:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:MrTJPCore:1.1.4:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForgeMultipart:1.3.1:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:ForgeRelocation:0.0.3:dev")
reobfJarConfiguration group: 'curse.maven', name: 'cofh-core-69162', version: '2388750'
runtimeOnly("com.github.GTNewHorizons:AppleCore:3.2.9:dev")
runtimeOnly("com.github.GTNewHorizons:Hodgepodge:2.0.28:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:AppleCore:3.2.9:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Hodgepodge:2.0.28:dev")
}
if (addReikaModsForTesting) {
// DragonAPI
Expand Down
2 changes: 2 additions & 0 deletions java9args.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ java.base/sun.nio.ch=ALL-UNNAMED
jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming
--add-opens
java.desktop/sun.awt.image=ALL-UNNAMED
--add-opens
java.desktop/com.sun.imageio.plugins.png=ALL-UNNAMED
--add-modules jdk.dynalink
--add-opens
jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED
Expand Down
4 changes: 2 additions & 2 deletions prism-libraries/mmc-pack.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"components": [
{
"cachedName": "LWJGL 3",
"cachedVersion": "3.3.2-SNAPSHOT-3.3.2-20230304.162250-10",
"cachedVersion": "3.3.2",
"cachedVolatile": true,
"dependencyOnly": true,
"uid": "org.lwjgl3",
Expand All @@ -22,7 +22,7 @@
"version": "1.7.10"
},
{
"cachedName": "Forge-J9-Patches",
"cachedName": "Forge-lwjgl3ify-Patches",
"cachedVersion": "${version}",
"uid": "me.eigenraven.lwjgl3ify.forgepatches"
},
Expand Down
22 changes: 2 additions & 20 deletions prism-libraries/patches/me.eigenraven.lwjgl3ify.forgepatches.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
{
"formatVersion": 1,
"name": "Forge-J9-Patches",
"name": "Forge-lwjgl3ify-Patches",
"uid": "me.eigenraven.lwjgl3ify.forgepatches",
"version": "${version}",
"order": 3,
"+jvmArgs": [
"--illegal-access=warn",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.text=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules", "java.sql.rowset",
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
${jvmArgs}
],
"libraries": [
{
Expand Down
Loading

0 comments on commit 807cca2

Please sign in to comment.