Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix runtime crash on Intel Mac's when LWJGL has been updated. #964

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public ApplicationResult getApplicationResult() {
return ApplicationResult.MUST_APPLY;
}

if (platform.getOperatingSystem().isMacOS() && context.isJava19OrLater() && !context.supportsJava19OrLater()) {
// Apply when LWJGL has been updated on MacOS to support Java 19
return ApplicationResult.MUST_APPLY;
}

// A developer can opt into this
return ApplicationResult.CAN_APPLY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class LWJGL3UpgradeLibraryProcessorTest extends LibraryProcessorTest {
"1.12.2" || LibraryProcessor.ApplicationResult.DONT_APPLY // Not LWJGL 3
}

// TODO once Minecraft updates to LWJGL 3.3.2 add a new test for this that uses that mc version
def "Apply when using Java 19 or later"() {
when:
def (_, context) = getLibs("1.19.4", PlatformTestUtils.WINDOWS_X64, version)
Expand All @@ -66,6 +65,21 @@ class LWJGL3UpgradeLibraryProcessorTest extends LibraryProcessorTest {
JavaVersion.VERSION_1_8 || LibraryProcessor.ApplicationResult.CAN_APPLY
}

def "Dont apply when using Java 19 or later on supported LWJGL version"() {
when:
def (_, context) = getLibs("1.20.2", PlatformTestUtils.WINDOWS_X64, version)
def processor = new LWJGL3UpgradeLibraryProcessor(PlatformTestUtils.WINDOWS_X64, context)
then:
processor.applicationResult == result

where:
version || result
JavaVersion.VERSION_20 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_19 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_17 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_1_8 || LibraryProcessor.ApplicationResult.CAN_APPLY
}

def "Apply when adding macOS ARM64 support"() {
when:
def (_, context) = getLibs(id, PlatformTestUtils.MAC_OS_ARM64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

package net.fabricmc.loom.test.unit.library.processors

import org.gradle.api.JavaVersion

import net.fabricmc.loom.configuration.providers.minecraft.library.Library
import net.fabricmc.loom.configuration.providers.minecraft.library.LibraryProcessor
import net.fabricmc.loom.configuration.providers.minecraft.library.processors.LoomNativeSupportLibraryProcessor
Expand All @@ -48,6 +50,51 @@ class LoomNativeSupportLibraryProcessorTest extends LibraryProcessorTest {
"1.12.2" || LibraryProcessor.ApplicationResult.DONT_APPLY // Not LWJGL 3
}

def "Apply when using Java 19 or later on macOS"() {
when:
def (_, context) = getLibs("1.19.4", PlatformTestUtils.MAC_OS_X64, version)
def processor = new LoomNativeSupportLibraryProcessor(PlatformTestUtils.MAC_OS_X64, context)
then:
processor.applicationResult == result

where:
version || result
JavaVersion.VERSION_20 || LibraryProcessor.ApplicationResult.MUST_APPLY
JavaVersion.VERSION_19 || LibraryProcessor.ApplicationResult.MUST_APPLY
JavaVersion.VERSION_17 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_1_8 || LibraryProcessor.ApplicationResult.CAN_APPLY
}

def "Dont apply when using Java 19 or later on macOS with supported version"() {
when:
def (_, context) = getLibs("1.20.2", PlatformTestUtils.MAC_OS_X64, version)
def processor = new LoomNativeSupportLibraryProcessor(PlatformTestUtils.MAC_OS_X64, context)
then:
processor.applicationResult == result

where:
version || result
JavaVersion.VERSION_20 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_19 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_17 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_1_8 || LibraryProcessor.ApplicationResult.CAN_APPLY
}

def "Can apply when using Java 19 or later on other platforms"() {
when:
def (_, context) = getLibs("1.19.4", PlatformTestUtils.WINDOWS_ARM64, version)
def processor = new LoomNativeSupportLibraryProcessor(PlatformTestUtils.WINDOWS_ARM64, context)
then:
processor.applicationResult == result

where:
version || result
JavaVersion.VERSION_20 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_19 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_17 || LibraryProcessor.ApplicationResult.CAN_APPLY
JavaVersion.VERSION_1_8 || LibraryProcessor.ApplicationResult.CAN_APPLY
}

def "Can apply on other platforms"() {
when:
def (_, context) = getLibs(id, platform)
Expand Down
Loading