mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-08-03 11:26:38 -04:00
Bump JavaFX to 17.0.15/24.0.1 (#3927)
This commit is contained in:
parent
48e3f79965
commit
7c40dca3ea
@ -107,9 +107,18 @@ public final class SelfDependencyPatcher {
|
||||
static List<DependencyDescriptor> readDependencies() {
|
||||
//noinspection ConstantConditions
|
||||
try (Reader reader = new InputStreamReader(SelfDependencyPatcher.class.getResourceAsStream(DEPENDENCIES_LIST_FILE), UTF_8)) {
|
||||
Map<String, List<DependencyDescriptor>> allDependencies =
|
||||
JsonUtils.GSON.fromJson(reader, mapTypeOf(String.class, listTypeOf(DependencyDescriptor.class)));
|
||||
return allDependencies.get(Platform.getPlatform().toString());
|
||||
Map<String, Map<String, List<DependencyDescriptor>>> allDependencies =
|
||||
JsonUtils.GSON.fromJson(reader, mapTypeOf(String.class, mapTypeOf(String.class, listTypeOf(DependencyDescriptor.class))));
|
||||
Map<String, List<DependencyDescriptor>> platform = allDependencies.get(Platform.getPlatform().toString());
|
||||
if (platform == null)
|
||||
return null;
|
||||
|
||||
if (JavaRuntime.CURRENT_VERSION >= 22) {
|
||||
List<DependencyDescriptor> modernDependencies = platform.get("modern");
|
||||
if (modernDependencies != null)
|
||||
return modernDependencies;
|
||||
}
|
||||
return platform.get("classic");
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
|
@ -1,314 +1,468 @@
|
||||
{
|
||||
"windows-x86": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "6c9ebafc7f9c4544d72fa5e306f4111e56b5db58"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "a14a1fbe3a0dca81d99c53fd7be8e7c784a68afe"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "7df1501701f9e9fbadab8ce55ef1dde128e2e88a"
|
||||
}
|
||||
],
|
||||
"windows-x86_64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.13",
|
||||
"classifier": "win",
|
||||
"sha1": "ae86377359860449040372d3693bccf046148513"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.13",
|
||||
"classifier": "win",
|
||||
"sha1": "bc0055a059b201d6c0be2293ccf72b6d2874fd1c"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.13",
|
||||
"classifier": "win",
|
||||
"sha1": "bcd765dca36fa9e5fb4c997491a2d908947603f5"
|
||||
}
|
||||
],
|
||||
"windows-arm64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "4518a696b9d509dc09a7fe283452fce84a1686a8"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "e19ba9aefc4bba8ff86dcdf416620b93b7bdea39"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "0bf7380823bb8c420dd41837d2c71087b8953ec1"
|
||||
}
|
||||
],
|
||||
"macos-x86_64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "73e422d8426aaa23e8c712b9f4d9bebf70d3bfb9"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "6ab6f3e23421fcfa04e692d9d26a8f55a830c114"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "b7786b1b63e741c0e234829825fae5fef9d96c31"
|
||||
}
|
||||
],
|
||||
"macos-arm64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "1d0d887c492330ed527b0614d115a4f32d2d05a4"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "64db28799e61e0f8f51e471c732599b2a6961803"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "3a14bd5f3ebe45d344c1f2bade0fe074e6ea2a83"
|
||||
}
|
||||
],
|
||||
"linux-x86_64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.13",
|
||||
"classifier": "linux",
|
||||
"sha1": "875f02b498b00c9692f6ed0af3da373b1d07bf03"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.13",
|
||||
"classifier": "linux",
|
||||
"sha1": "103f3bba5a177ba8912a92ef2ee0855de7ba050c"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.13",
|
||||
"classifier": "linux",
|
||||
"sha1": "940e9e05a974a3e484d5ec241d88a0c77ad013f2"
|
||||
}
|
||||
],
|
||||
"linux-arm32": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "452f455d6948788c1e5350a41259eb8101d3f82a"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "b45b33252e88263fe80a462a45828b4562c3c709"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "e606c619fc493ecd18d281b0ded3aa38ba15a9e5"
|
||||
}
|
||||
],
|
||||
"linux-arm64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "1490bfe619e148b3d58746d43f549d697640c935"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "cad8004a87f57d9813c52985894ef15e8011baee"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "ccc33fc1fcbf46130346f4330d6d70b71bdec7d0"
|
||||
}
|
||||
],
|
||||
"linux-loongarch64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "9d692dfc79eb334a7b4bae922aa57cb3a437345e"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "7f241dc6adc8beddb776f453a3c63a5848d7b90b"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "1c8b0141bec93ed21d7c0e9a2f69a1c7e3c734d2"
|
||||
}
|
||||
],
|
||||
"linux-loongarch64_ow": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "f90663ba93aef9f818236ce19ecfa33dca0ffe10"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "6ff76304d08bba093abfe7f4d50ce6a49279c87f"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "8a16096d42de70f2548f18840cdcd49a07fc1654"
|
||||
}
|
||||
],
|
||||
"linux-riscv64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "e33c7e0bac2931a8f7a752bb74e4e4e535eec4ad"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "ac4e5edd55d84da80f8fc2d81a4c9994296a6c09"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "efe6a87ea24972d45f1931528f87e64a53bd2232"
|
||||
}
|
||||
],
|
||||
"freebsd-x86_64": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "7bac900f0ab0d4d6dcf178252cf37ee1e0470d40"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "7773ce02d1dc29160801e4e077ed2a26e93bed13"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "34a3dd3ccbc898bacfdcb3256cfb87ddc50621d3"
|
||||
}
|
||||
]
|
||||
"windows-x86": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "6c9ebafc7f9c4544d72fa5e306f4111e56b5db58"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "a14a1fbe3a0dca81d99c53fd7be8e7c784a68afe"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "win-x86",
|
||||
"sha1": "7df1501701f9e9fbadab8ce55ef1dde128e2e88a"
|
||||
}
|
||||
]
|
||||
},
|
||||
"windows-x86_64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.15",
|
||||
"classifier": "win",
|
||||
"sha1": "b953b8de9dc783cf2d3b5be404e7b4413f9d88f3"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.15",
|
||||
"classifier": "win",
|
||||
"sha1": "970f11897d7852e9afcb470e89370532dbab1e00"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.15",
|
||||
"classifier": "win",
|
||||
"sha1": "b5df9cb5cc79714133119259c0bc31a201e27827"
|
||||
}
|
||||
],
|
||||
"modern": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "24.0.1",
|
||||
"classifier": "win",
|
||||
"sha1": "4b10eb55326c5faae8b0fcaff99a0e8a09ee0624"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "24.0.1",
|
||||
"classifier": "win",
|
||||
"sha1": "0d432e25ea9cd73fb28b89658e0cba8b55e2b5b9"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "24.0.1",
|
||||
"classifier": "win",
|
||||
"sha1": "1a11fceb872b9d81234601a32b7bd0e9f9d40921"
|
||||
}
|
||||
]
|
||||
},
|
||||
"windows-arm64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "4518a696b9d509dc09a7fe283452fce84a1686a8"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "e19ba9aefc4bba8ff86dcdf416620b93b7bdea39"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "18.0.2+1-arm64",
|
||||
"classifier": "win",
|
||||
"sha1": "0bf7380823bb8c420dd41837d2c71087b8953ec1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"macos-x86_64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac",
|
||||
"sha1": "c81789b67704792ce3aa14ae0831f03953a94fd1"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac",
|
||||
"sha1": "ba75ad11b6e8f0f1e69e3f812e983ba7bc8862ad"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac",
|
||||
"sha1": "667947ed5cf35aafe1942536b4a2ec382d4a23c0"
|
||||
}
|
||||
],
|
||||
"modern": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "d83afabb980754a820f9d590e57ca3741178d330"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "c42ed790229c95870622ec3c9657ae24c49b6004"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac",
|
||||
"sha1": "ee58a229feba345b15832a3b9dfdb2f81609ff7e"
|
||||
}
|
||||
]
|
||||
},
|
||||
"macos-arm64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "0eb5a3f4592687a22aabf174a7e5cb05c54aae17"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "4c32f1341358627d1b7c4cb0c5a0bdd2617bb314"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.15",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "542d9ca6e6d8579e17a1af9fcdceb69dc3c6d983"
|
||||
}
|
||||
],
|
||||
"modern": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "0278a9d1c739148c56ff0c96c9263fe27486526e"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "a7f93849791b2b1ef7b94584a77bb5246e2127dc"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "24.0.1",
|
||||
"classifier": "mac-aarch64",
|
||||
"sha1": "1aca61b354055c454e64a6781c60d1a908900c51"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.15",
|
||||
"classifier": "linux",
|
||||
"sha1": "ae63c4eae7766f2d7afcdab9c9ffbc10e7ee3b57"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.15",
|
||||
"classifier": "linux",
|
||||
"sha1": "9eead4a031fa59c7c66fad177c2786faf149790d"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.15",
|
||||
"classifier": "linux",
|
||||
"sha1": "31a1887450c2780f1b85eac11b305604f87cdbb7"
|
||||
}
|
||||
],
|
||||
"modern": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux",
|
||||
"sha1": "1eb0dd4c9b54075b121b2246c41e2ff767b81768"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux",
|
||||
"sha1": "c0b9013d797e001b364baaa14cbe988b2dea28bf"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux",
|
||||
"sha1": "8946a980ee0077bd28752db645155fb292931d6e"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-arm32": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "452f455d6948788c1e5350a41259eb8101d3f82a"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "b45b33252e88263fe80a462a45828b4562c3c709"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-arm32-monocle",
|
||||
"sha1": "e606c619fc493ecd18d281b0ded3aa38ba15a9e5"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-arm64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "1490bfe619e148b3d58746d43f549d697640c935"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "cad8004a87f57d9813c52985894ef15e8011baee"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "ccc33fc1fcbf46130346f4330d6d70b71bdec7d0"
|
||||
}
|
||||
],
|
||||
"modern": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "83340233e069b98a9fcf5b8196145a5eb8a3d870"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "cd153842a963efe000f038561a03b45bc8ce3307"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "24.0.1",
|
||||
"classifier": "linux-aarch64",
|
||||
"sha1": "02b8715e07579c3de1bd50fe51209666bba52d48"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-loongarch64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "9d692dfc79eb334a7b4bae922aa57cb3a437345e"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "7f241dc6adc8beddb776f453a3c63a5848d7b90b"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "17.0.8-loongarch64",
|
||||
"classifier": "linux",
|
||||
"sha1": "1c8b0141bec93ed21d7c0e9a2f69a1c7e3c734d2"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-loongarch64_ow": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "f90663ba93aef9f818236ce19ecfa33dca0ffe10"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "6ff76304d08bba093abfe7f4d50ce6a49279c87f"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19-ea+10-loongson64",
|
||||
"classifier": "linux",
|
||||
"sha1": "8a16096d42de70f2548f18840cdcd49a07fc1654"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux-riscv64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "e33c7e0bac2931a8f7a752bb74e4e4e535eec4ad"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "ac4e5edd55d84da80f8fc2d81a4c9994296a6c09"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "19.0.2.1-riscv64",
|
||||
"classifier": "linux",
|
||||
"sha1": "efe6a87ea24972d45f1931528f87e64a53bd2232"
|
||||
}
|
||||
]
|
||||
},
|
||||
"freebsd-x86_64": {
|
||||
"classic": [
|
||||
{
|
||||
"module": "javafx.base",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-base",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "7bac900f0ab0d4d6dcf178252cf37ee1e0470d40"
|
||||
},
|
||||
{
|
||||
"module": "javafx.graphics",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-graphics",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "7773ce02d1dc29160801e4e077ed2a26e93bed13"
|
||||
},
|
||||
{
|
||||
"module": "javafx.controls",
|
||||
"groupId": "org.glavo.hmcl.openjfx",
|
||||
"artifactId": "javafx-controls",
|
||||
"version": "14.0.2.1-freebsd",
|
||||
"classifier": "freebsd",
|
||||
"sha1": "34a3dd3ccbc898bacfdcb3256cfb87ddc50621d3"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -107,8 +107,6 @@ tasks.register("checkTranslations") {
|
||||
}
|
||||
}
|
||||
|
||||
apply {
|
||||
from("javafx.gradle.kts")
|
||||
}
|
||||
org.jackhuang.hmcl.gradle.javafx.JavaFXUtils.register(rootProject)
|
||||
|
||||
defaultTasks("clean", "build")
|
||||
|
@ -4,6 +4,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation(libs.gson)
|
||||
implementation(libs.jna)
|
||||
}
|
||||
|
||||
java {
|
||||
|
@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Hello Minecraft! Launcher
|
||||
* Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.jackhuang.hmcl.gradle.javafx;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Glavo
|
||||
*/
|
||||
public final class JavaFXPlatform {
|
||||
|
||||
public static final String LEGACY_JAVAFX_VERSION = "19.0.2.1";
|
||||
public static final String CLASSIC_JAVAFX_VERSION = "17.0.15";
|
||||
public static final String MODERN_JAVAFX_VERSION = "24.0.1";
|
||||
|
||||
private static final int JAVA_11 = 11;
|
||||
private static final int JAVA_22 = 22;
|
||||
|
||||
private static final String OFFICIAL_GROUP_ID = "org.openjfx";
|
||||
private static final String GLAVO_GROUP_ID = "org.glavo.hmcl.openjfx";
|
||||
|
||||
public static final Map<String, JavaFXPlatform> ALL = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
Map<JavaFXVersionType, String> legacyVersions = Map.of(JavaFXVersionType.CLASSIC, LEGACY_JAVAFX_VERSION);
|
||||
|
||||
// Windows
|
||||
ALL.put("windows-x86", new JavaFXPlatform("win-x86", legacyVersions));
|
||||
ALL.put("windows-x86_64", new JavaFXPlatform("win"));
|
||||
ALL.put("windows-arm64", new JavaFXPlatform("win", GLAVO_GROUP_ID, "18.0.2+1-arm64"));
|
||||
|
||||
// macOS
|
||||
ALL.put("macos-x86_64", new JavaFXPlatform("mac"));
|
||||
ALL.put("macos-arm64", new JavaFXPlatform("mac-aarch64"));
|
||||
|
||||
// Linux
|
||||
ALL.put("linux-x86_64", new JavaFXPlatform("linux"));
|
||||
ALL.put("linux-arm32", new JavaFXPlatform("linux-arm32-monocle", legacyVersions));
|
||||
ALL.put("linux-arm64", new JavaFXPlatform("linux-aarch64", Map.of(
|
||||
JavaFXVersionType.CLASSIC, LEGACY_JAVAFX_VERSION,
|
||||
JavaFXVersionType.MODERN, MODERN_JAVAFX_VERSION
|
||||
)));
|
||||
ALL.put("linux-loongarch64", new JavaFXPlatform("linux", GLAVO_GROUP_ID, "17.0.8-loongarch64"));
|
||||
ALL.put("linux-loongarch64_ow", new JavaFXPlatform("linux", GLAVO_GROUP_ID, "19-ea+10-loongson64"));
|
||||
ALL.put("linux-riscv64", new JavaFXPlatform("linux", GLAVO_GROUP_ID, "19.0.2.1-riscv64"));
|
||||
|
||||
// FreeBSD
|
||||
ALL.put("freebsd-x86_64", new JavaFXPlatform("freebsd", GLAVO_GROUP_ID, "14.0.2.1-freebsd"));
|
||||
}
|
||||
|
||||
private final String classifier;
|
||||
private final String groupId;
|
||||
private final SortedMap<JavaFXVersionType, String> versions;
|
||||
|
||||
public JavaFXPlatform(String classifier) {
|
||||
this(classifier, OFFICIAL_GROUP_ID, Map.of(
|
||||
JavaFXVersionType.CLASSIC, CLASSIC_JAVAFX_VERSION,
|
||||
JavaFXVersionType.MODERN, MODERN_JAVAFX_VERSION
|
||||
));
|
||||
}
|
||||
|
||||
public JavaFXPlatform(String classifier, Map<JavaFXVersionType, String> versions) {
|
||||
this(classifier, OFFICIAL_GROUP_ID, versions);
|
||||
}
|
||||
|
||||
public JavaFXPlatform(String classifier, String groupId, String version) {
|
||||
this(classifier, groupId, Map.of(JavaFXVersionType.CLASSIC, version));
|
||||
}
|
||||
|
||||
public JavaFXPlatform(String classifier, String groupId, Map<JavaFXVersionType, String> versions) {
|
||||
this.classifier = classifier;
|
||||
this.groupId = groupId;
|
||||
this.versions = Collections.unmodifiableSortedMap(new TreeMap<>(versions));
|
||||
}
|
||||
|
||||
public String getClassifier() {
|
||||
return classifier;
|
||||
}
|
||||
|
||||
public String getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public SortedMap<JavaFXVersionType, String> getVersions() {
|
||||
return versions;
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
/*
|
||||
* Hello Minecraft! Launcher
|
||||
* Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.jackhuang.hmcl.gradle.javafx;
|
||||
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.sun.jna.Platform;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
/**
|
||||
* @author Glavo
|
||||
*/
|
||||
public final class JavaFXUtils {
|
||||
public static final String[] MODULES = {"base", "graphics", "controls"};
|
||||
|
||||
private static void addDependencies(Project rootProject) {
|
||||
try {
|
||||
Class.forName("javafx.application.Application", false, JavaFXUtils.class.getClassLoader());
|
||||
return;
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
String os;
|
||||
if (Platform.isWindows())
|
||||
os = "windows";
|
||||
else if (Platform.isMac())
|
||||
os = "macos";
|
||||
else if (Platform.isLinux())
|
||||
os = "linux";
|
||||
else if (Platform.isFreeBSD())
|
||||
os = "freebsd";
|
||||
else
|
||||
return;
|
||||
|
||||
String arch;
|
||||
if (Platform.isIntel())
|
||||
arch = Platform.is64Bit() ? "x86_64" : "x86";
|
||||
else if (Platform.isARM())
|
||||
arch = Platform.is64Bit() ? "arm64" : "arm32";
|
||||
else if (Platform.isLoongArch() && Platform.is64Bit())
|
||||
arch = "loongarch64";
|
||||
else if ("riscv64".equals(System.getProperty("os.arch"))) // TODO: https://github.com/java-native-access/jna/pull/1671
|
||||
arch = "riscv64";
|
||||
else
|
||||
return;
|
||||
|
||||
JavaFXPlatform platform = JavaFXPlatform.ALL.get(os + "-" + arch);
|
||||
if (platform != null) {
|
||||
int featureVersion = Runtime.version().feature();
|
||||
|
||||
String version;
|
||||
if (featureVersion >= 22)
|
||||
version = platform.getVersions().getOrDefault(JavaFXVersionType.MODERN, platform.getVersions().get(JavaFXVersionType.CLASSIC));
|
||||
else
|
||||
version = platform.getVersions().get(JavaFXVersionType.CLASSIC);
|
||||
|
||||
if (version != null) {
|
||||
rootProject.subprojects(project -> {
|
||||
for (String module : MODULES) {
|
||||
String dependency = String.format("%s:javafx-%s:%s:%s", platform.getGroupId(), module, version, platform.getClassifier());
|
||||
project.getDependencies().add("compileOnly", dependency);
|
||||
project.getDependencies().add("testImplementation", dependency);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateOpenJFXDependencies(Task task) {
|
||||
JsonObject dependenciesJson = new JsonObject();
|
||||
JavaFXPlatform.ALL.forEach((name, platform) -> {
|
||||
JsonObject platformJson = new JsonObject();
|
||||
platform.getVersions().forEach((versionType, version) -> {
|
||||
JsonArray modulesJson = new JsonArray();
|
||||
|
||||
for (String module : MODULES) {
|
||||
JsonObject moduleJson = new JsonObject();
|
||||
moduleJson.addProperty("module", "javafx." + module);
|
||||
moduleJson.addProperty("groupId", platform.getGroupId());
|
||||
moduleJson.addProperty("artifactId", "javafx-" + module);
|
||||
moduleJson.addProperty("version", version);
|
||||
moduleJson.addProperty("classifier", platform.getClassifier());
|
||||
|
||||
String shaUrl = String.format("https://repo1.maven.org/maven2/%s/javafx-%s/%s/javafx-%s-%s-%s.jar.sha1",
|
||||
platform.getGroupId().replace('.', '/'),
|
||||
module, version,
|
||||
module, version, platform.getClassifier()
|
||||
);
|
||||
task.getLogger().info("Fetching {}", shaUrl);
|
||||
try (InputStream stream = new URI(shaUrl).toURL().openStream()) {
|
||||
moduleJson.addProperty("sha1", new String(stream.readAllBytes(), StandardCharsets.UTF_8).trim());
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
throw new GradleException("Failed to fetch sha from " + shaUrl, e);
|
||||
}
|
||||
|
||||
modulesJson.add(moduleJson);
|
||||
}
|
||||
|
||||
platformJson.add(versionType.getName(), modulesJson);
|
||||
});
|
||||
dependenciesJson.add(name, platformJson);
|
||||
});
|
||||
|
||||
Path outputFile = task.getProject().getRootProject().file("HMCL/src/main/resources/assets/openjfx-dependencies.json").toPath().toAbsolutePath().normalize();
|
||||
try {
|
||||
Files.createDirectories(outputFile.getParent());
|
||||
Files.writeString(outputFile, new GsonBuilder().setPrettyPrinting().create().toJson(dependenciesJson));
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void preTouchOpenJFXDependencies(Task task) {
|
||||
String mirrorRepo = "https://mirrors.cloud.tencent.com/nexus/repository/maven-public";
|
||||
|
||||
JavaFXPlatform.ALL.forEach((name, platform) -> {
|
||||
platform.getVersions().forEach((versionType, version) -> {
|
||||
for (String module : MODULES) {
|
||||
String jarUrl = String.format("%s/%s/javafx-%s/%s/javafx-%s-%s-%s.jar",
|
||||
mirrorRepo,
|
||||
platform.getGroupId().replace('.', '/'),
|
||||
module, version,
|
||||
module, version, platform.getClassifier()
|
||||
);
|
||||
task.getLogger().info("Fetching {}", jarUrl);
|
||||
try (InputStream stream = new URI(jarUrl).toURL().openStream()) {
|
||||
stream.readNBytes(128);
|
||||
} catch (IOException ignored) {
|
||||
} catch (URISyntaxException e) {
|
||||
throw new GradleException("Failed to fetch jar from " + jarUrl, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public static void register(Project rootProject) {
|
||||
addDependencies(rootProject);
|
||||
|
||||
rootProject.getTasks().register("generateOpenJFXDependencies", task -> task.doLast(JavaFXUtils::generateOpenJFXDependencies));
|
||||
rootProject.getTasks().register("preTouchOpenJFXDependencies", task -> task.doLast(JavaFXUtils::preTouchOpenJFXDependencies));
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Hello Minecraft! Launcher
|
||||
* Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.jackhuang.hmcl.gradle.javafx;
|
||||
|
||||
/**
|
||||
* @author Glavo
|
||||
*/
|
||||
public enum JavaFXVersionType {
|
||||
CLASSIC("classic", 11),
|
||||
MODERN("modern", 22);
|
||||
|
||||
private final String name;
|
||||
private final int javaVersion;
|
||||
|
||||
JavaFXVersionType(String name, int javaVersion) {
|
||||
this.name = name;
|
||||
this.javaVersion = javaVersion;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getJavaVersion() {
|
||||
return javaVersion;
|
||||
}
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
val jfxVersion = "17.0.13"
|
||||
val oldJfxVersion = "19.0.2.1"
|
||||
|
||||
data class Platform(
|
||||
val name: String,
|
||||
val classifier: String,
|
||||
val groupId: String = "org.openjfx",
|
||||
val version: String = jfxVersion
|
||||
) {
|
||||
fun fileUrl(
|
||||
module: String, classifier: String, ext: String,
|
||||
repo: String = "https://repo1.maven.org/maven2"
|
||||
): java.net.URL =
|
||||
java.net.URI(
|
||||
"$repo/${groupId.replace('.', '/')}/javafx-$module/$version/javafx-$module-$version-$classifier.$ext"
|
||||
).toURL()
|
||||
}
|
||||
|
||||
val jfxModules = listOf("base", "graphics", "controls")
|
||||
val jfxMirrorRepos = listOf("https://mirrors.cloud.tencent.com/nexus/repository/maven-public")
|
||||
val jfxDependenciesFile = project.file("HMCL/src/main/resources/assets/openjfx-dependencies.json")
|
||||
val jfxPlatforms = listOf(
|
||||
Platform("windows-x86", "win-x86", version = oldJfxVersion),
|
||||
Platform("windows-x86_64", "win"),
|
||||
Platform("windows-arm64", "win", groupId = "org.glavo.hmcl.openjfx", version = "18.0.2+1-arm64"),
|
||||
Platform("macos-x86_64", "mac", version = oldJfxVersion),
|
||||
Platform("macos-arm64", "mac-aarch64", version = oldJfxVersion),
|
||||
Platform("linux-x86_64", "linux"),
|
||||
Platform("linux-arm32", "linux-arm32-monocle", version = oldJfxVersion),
|
||||
Platform("linux-arm64", "linux-aarch64", version = oldJfxVersion),
|
||||
Platform("linux-loongarch64", "linux", groupId = "org.glavo.hmcl.openjfx", version = "17.0.8-loongarch64"),
|
||||
Platform("linux-loongarch64_ow", "linux", groupId = "org.glavo.hmcl.openjfx", version = "19-ea+10-loongson64"),
|
||||
Platform("linux-riscv64", "linux", groupId = "org.glavo.hmcl.openjfx", version = "19.0.2.1-riscv64"),
|
||||
Platform("freebsd-x86_64", "freebsd", groupId = "org.glavo.hmcl.openjfx", version = "14.0.2.1-freebsd"),
|
||||
)
|
||||
|
||||
val jfxInClasspath =
|
||||
try {
|
||||
Class.forName("javafx.application.Application", false, this.javaClass.classLoader)
|
||||
true
|
||||
} catch (ignored: Throwable) {
|
||||
false
|
||||
}
|
||||
|
||||
if (!jfxInClasspath && JavaVersion.current() >= JavaVersion.VERSION_11) {
|
||||
val os = System.getProperty("os.name").lowercase().let { osName ->
|
||||
when {
|
||||
osName.contains("win") -> "windows"
|
||||
osName.contains("mac") -> "macos"
|
||||
osName.contains("linux") || osName.contains("unix") -> "linux"
|
||||
osName.contains("freebsd") -> "freebsd"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
val arch = when (System.getProperty("os.arch").lowercase()) {
|
||||
"x86_64", "x86-64", "amd64", "ia32e", "em64t", "x64" -> "x86_64"
|
||||
"x86", "x86_32", "x86-32", "i386", "i486", "i586", "i686", "i86pc", "ia32", "x32" -> "x86"
|
||||
"arm64", "aarch64", "armv8", "armv9" -> "arm64"
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (os != null && arch != null) {
|
||||
val platform = jfxPlatforms.find { it.name == "$os-$arch" }
|
||||
if (platform != null) {
|
||||
val groupId = platform.groupId
|
||||
val version = platform.version
|
||||
val classifier = platform.classifier
|
||||
rootProject.subprojects {
|
||||
for (module in jfxModules) {
|
||||
dependencies.add("compileOnly", "$groupId:javafx-$module:$version:$classifier")
|
||||
dependencies.add("testImplementation", "$groupId:javafx-$module:$version:$classifier")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.tasks.register("generateOpenJFXDependencies") {
|
||||
doLast {
|
||||
val jfxDependencies = jfxPlatforms.associate { platform ->
|
||||
platform.name to jfxModules.map { module ->
|
||||
mapOf(
|
||||
"module" to "javafx.$module",
|
||||
"groupId" to platform.groupId,
|
||||
"artifactId" to "javafx-$module",
|
||||
"version" to platform.version,
|
||||
"classifier" to platform.classifier,
|
||||
"sha1" to platform.fileUrl(module, platform.classifier, "jar.sha1").readText()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jfxDependenciesFile.parentFile.mkdirs()
|
||||
jfxDependenciesFile.writeText(
|
||||
com.google.gson.GsonBuilder().setPrettyPrinting().create().toJson(jfxDependencies)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that the mirror repository caches files
|
||||
rootProject.tasks.register("preTouchOpenJFXDependencies") {
|
||||
doLast {
|
||||
for (repo in jfxMirrorRepos) {
|
||||
for (platform in jfxPlatforms) {
|
||||
for (module in jfxModules) {
|
||||
val url = platform.fileUrl(module, platform.classifier, "jar", repo = repo)
|
||||
logger.quiet("Getting $url")
|
||||
try {
|
||||
url.readBytes()
|
||||
} catch (e: Throwable) {
|
||||
logger.warn("An exception occurred while pre touching $url", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user