Update java-objc-bridge for arm64 MacOS support. Fixes the narrator.
parent
46c6a2757a
commit
316f9d9508
|
@ -52,6 +52,12 @@ public class LWJGLVersionOverride {
|
||||||
);
|
);
|
||||||
public static final List<String> NATIVES = DEPENDENCIES.stream().map(s -> s + ":" + NATIVE_CLASSIFIER).toList();
|
public static final List<String> NATIVES = DEPENDENCIES.stream().map(s -> s + ":" + NATIVE_CLASSIFIER).toList();
|
||||||
|
|
||||||
|
public static final List<String> MACOS_DEPENDENCIES = List.of(
|
||||||
|
"ca.weblite:java-objc-bridge:1.1"
|
||||||
|
);
|
||||||
|
// Same for now, as java-objc-bridge includes the natives in the main jar.
|
||||||
|
public static final List<String> MACOS_NATIVES = MACOS_DEPENDENCIES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update lwjgl by default when running on arm and a supported configuration.
|
* Update lwjgl by default when running on arm and a supported configuration.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.gradle.api.artifacts.ExternalModuleDependency;
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.configuration.providers.BundleMetadata;
|
import net.fabricmc.loom.configuration.providers.BundleMetadata;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
|
import net.fabricmc.loom.util.OperatingSystem;
|
||||||
|
|
||||||
public class MinecraftLibraryProvider {
|
public class MinecraftLibraryProvider {
|
||||||
private static final Pattern NATIVES_PATTERN = Pattern.compile("^(?<group>.*)/(.*?)/(?<version>.*)/((?<name>.*?)-([0-9].*?)-)(?<classifier>.*).jar$");
|
private static final Pattern NATIVES_PATTERN = Pattern.compile("^(?<group>.*)/(.*?)/(?<version>.*)/((?<name>.*?)-([0-9].*?)-)(?<classifier>.*).jar$");
|
||||||
|
@ -45,6 +46,7 @@ public class MinecraftLibraryProvider {
|
||||||
final boolean runtimeOnlyLog4j = extension.getRuntimeOnlyLog4j().get();
|
final boolean runtimeOnlyLog4j = extension.getRuntimeOnlyLog4j().get();
|
||||||
|
|
||||||
final boolean overrideLWJGL = LWJGLVersionOverride.overrideByDefault() || LWJGLVersionOverride.forceOverride(project) || Boolean.getBoolean("loom.test.lwjgloverride");
|
final boolean overrideLWJGL = LWJGLVersionOverride.overrideByDefault() || LWJGLVersionOverride.forceOverride(project) || Boolean.getBoolean("loom.test.lwjgloverride");
|
||||||
|
final boolean isMacOS = OperatingSystem.CURRENT_OS.equals(OperatingSystem.MAC_OS);
|
||||||
|
|
||||||
if (overrideLWJGL) {
|
if (overrideLWJGL) {
|
||||||
project.getLogger().warn("Loom is upgrading Minecraft's LWJGL version to {}", LWJGLVersionOverride.LWJGL_VERSION);
|
project.getLogger().warn("Loom is upgrading Minecraft's LWJGL version to {}", LWJGLVersionOverride.LWJGL_VERSION);
|
||||||
|
@ -86,6 +88,11 @@ public class MinecraftLibraryProvider {
|
||||||
|
|
||||||
final String dependencyNotation = "%s:%s:%s:%s".formatted(group, name, version, classifier);
|
final String dependencyNotation = "%s:%s:%s:%s".formatted(group, name, version, classifier);
|
||||||
|
|
||||||
|
if (overrideLWJGL && isMacOS && "java-objc-bridge".equals(name)) {
|
||||||
|
// Mojang split out the natives into their own jar, skip over Mojang's jar and use the official jar later on.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
project.getLogger().debug("Add native dependency '{}'", dependencyNotation);
|
project.getLogger().debug("Add native dependency '{}'", dependencyNotation);
|
||||||
project.getDependencies().add(Constants.Configurations.MINECRAFT_NATIVES, dependencyNotation);
|
project.getDependencies().add(Constants.Configurations.MINECRAFT_NATIVES, dependencyNotation);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +102,11 @@ public class MinecraftLibraryProvider {
|
||||||
LWJGLVersionOverride.DEPENDENCIES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_DEPENDENCIES, s));
|
LWJGLVersionOverride.DEPENDENCIES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_DEPENDENCIES, s));
|
||||||
LWJGLVersionOverride.NATIVES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_NATIVES, s));
|
LWJGLVersionOverride.NATIVES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_NATIVES, s));
|
||||||
|
|
||||||
|
if (isMacOS) {
|
||||||
|
LWJGLVersionOverride.MACOS_DEPENDENCIES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_DEPENDENCIES, s));
|
||||||
|
LWJGLVersionOverride.MACOS_NATIVES.forEach(s -> project.getDependencies().add(Constants.Configurations.MINECRAFT_NATIVES, s));
|
||||||
|
}
|
||||||
|
|
||||||
// Add the native support mod that fixes a handful of issues related to the LWJGL update at runtime.
|
// Add the native support mod that fixes a handful of issues related to the LWJGL update at runtime.
|
||||||
ExternalModuleDependency dependency = (ExternalModuleDependency) project.getDependencies().create(Constants.Dependencies.NATIVE_SUPPORT + Constants.Dependencies.Versions.NATIVE_SUPPORT_VERSION);
|
ExternalModuleDependency dependency = (ExternalModuleDependency) project.getDependencies().create(Constants.Dependencies.NATIVE_SUPPORT + Constants.Dependencies.Versions.NATIVE_SUPPORT_VERSION);
|
||||||
dependency.setTransitive(false);
|
dependency.setTransitive(false);
|
||||||
|
|
Loading…
Reference in New Issue