select classifier according to the platform
This commit is contained in:
@@ -79,18 +79,34 @@ public final class SelfDependencyPatcher {
|
|||||||
|
|
||||||
static class DependencyDescriptor {
|
static class DependencyDescriptor {
|
||||||
|
|
||||||
// private static final String REPOSITORY_URL = System.getProperty("hmcl.openjfx.repo", "https://maven.aliyun.com/repository/central/");
|
|
||||||
private static final Path DEPENDENCIES_DIR_PATH = HMCL_DIRECTORY.resolve("dependencies");
|
private static final Path DEPENDENCIES_DIR_PATH = HMCL_DIRECTORY.resolve("dependencies");
|
||||||
|
|
||||||
|
public static final String CURRENT_ARCH_CLASSIFIER = currentArchClassifier();
|
||||||
|
|
||||||
private static String currentArchClassifier() {
|
private static String currentArchClassifier() {
|
||||||
switch (OperatingSystem.CURRENT_OS) {
|
if (OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
|
||||||
case LINUX:
|
switch (Architecture.CURRENT) {
|
||||||
return "linux";
|
case X86_64:
|
||||||
case OSX:
|
return "linux";
|
||||||
return "mac";
|
case ARM64:
|
||||||
default:
|
return "linux-aarch64";
|
||||||
return "win";
|
}
|
||||||
|
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.OSX) {
|
||||||
|
switch (Architecture.CURRENT) {
|
||||||
|
case X86_64:
|
||||||
|
return "mac";
|
||||||
|
case ARM64:
|
||||||
|
return "mac-aarch64";
|
||||||
|
}
|
||||||
|
} else if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
|
||||||
|
switch (Architecture.CURRENT) {
|
||||||
|
case X86_64:
|
||||||
|
return "win";
|
||||||
|
case X86:
|
||||||
|
return "win-x86";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String module;
|
public String module;
|
||||||
@@ -100,14 +116,23 @@ public final class SelfDependencyPatcher {
|
|||||||
public Map<String, String> sha1;
|
public Map<String, String> sha1;
|
||||||
|
|
||||||
public String filename() {
|
public String filename() {
|
||||||
return artifactId + "-" + version + "-" + currentArchClassifier() + ".jar";
|
if (CURRENT_ARCH_CLASSIFIER == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return artifactId + "-" + version + "-" + CURRENT_ARCH_CLASSIFIER + ".jar";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String sha1() {
|
public String sha1() {
|
||||||
return sha1.get(currentArchClassifier());
|
if (CURRENT_ARCH_CLASSIFIER == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sha1.get(CURRENT_ARCH_CLASSIFIER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path localPath() {
|
public Path localPath() {
|
||||||
|
if (CURRENT_ARCH_CLASSIFIER == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return DEPENDENCIES_DIR_PATH.resolve(filename());
|
return DEPENDENCIES_DIR_PATH.resolve(filename());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,9 +217,8 @@ public final class SelfDependencyPatcher {
|
|||||||
throw new IncompatibleVersionException();
|
throw new IncompatibleVersionException();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can only self-patch JavaFX on x86-64 platform.
|
// We can only self-patch JavaFX on specific platform.
|
||||||
// For ARM support, user's manual patch is required.
|
if (DependencyDescriptor.CURRENT_ARCH_CLASSIFIER == null) {
|
||||||
if (Architecture.CURRENT != Architecture.X86_64) {
|
|
||||||
throw new IncompatibleVersionException();
|
throw new IncompatibleVersionException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user