From e0f7d9cd32afeedb51cf376515413a6602a11ff4 Mon Sep 17 00:00:00 2001 From: Glavo Date: Mon, 17 Jan 2022 23:48:15 +0800 Subject: [PATCH] Generate 'openjfx-dependencies.json' at build time --- HMCL/build.gradle.kts | 5 ++ .../assets/openjfx-dependencies.json | 90 ------------------- build.gradle.kts | 5 +- 3 files changed, 9 insertions(+), 91 deletions(-) delete mode 100644 HMCL/src/main/resources/assets/openjfx-dependencies.json diff --git a/HMCL/build.gradle.kts b/HMCL/build.gradle.kts index 373a94876..3f7003d89 100644 --- a/HMCL/build.gradle.kts +++ b/HMCL/build.gradle.kts @@ -221,6 +221,11 @@ tasks.processResources { from(sourceSets["java11"].output) } dependsOn(tasks["java11Classes"]) + + into("assets") { + from(project.buildDir.resolve("openjfx-dependencies.json")) + } + dependsOn(rootProject.tasks["generateOpenJFXDependencies"]) } val packFile = File(jarPath.parentFile, jarPath.nameWithoutExtension + ".pack") diff --git a/HMCL/src/main/resources/assets/openjfx-dependencies.json b/HMCL/src/main/resources/assets/openjfx-dependencies.json deleted file mode 100644 index fc5fa6771..000000000 --- a/HMCL/src/main/resources/assets/openjfx-dependencies.json +++ /dev/null @@ -1,90 +0,0 @@ -[ - { - "module": "javafx.base", - "groupId": "org.openjfx", - "artifactId": "javafx-base", - "version": "17", - "sha1": { - "linux": "476c7640c2320244d3156edbbc19a7eda275c1ed", - "linux-arm32-monocle": "1dad2b0479066fc65ce83ae276632b0be4a648f7", - "linux-aarch64": "b62b6cae95847fda1dce4a8a29edcf8a31b85333", - "mac": "61d52392b063be78f7cc1b0fbfc04dda7a835a15", - "mac-aarch64": "d77b645fa3e1a6270783178541944e4b4a457cd2", - "win": "b63b9696f73009ca5002f49ec4db73576e2de168", - "win-x86": "d35c89f5cb5f9dd8c54c69b4a153a94377e60931" - } - }, - { - "module": "javafx.graphics", - "groupId": "org.openjfx", - "artifactId": "javafx-graphics", - "version": "17", - "sha1": { - "linux": "88dc59568c14ec37ea1c42b3ba472d78b4b1030a", - "linux-arm32-monocle": "44284bba939b1249fcc3f5502a70bd48e88e1fa9", - "linux-aarch64": "40bd7094b8f43d4637a8a274b4b199835d6cfd5c", - "mac": "8b1d1124ce83e874db390016913fba7708f3592d", - "mac-aarch64": "b6326f61f7e0effbf733d62e83b8317eb8e768b4", - "win": "2c56d252b97eba8b42f049c6ce145172d744ce08", - "win-x86": "c4d74a11a7ffb182fb43803756e678c87876a0a4" - } - }, - { - "module": "javafx.controls", - "groupId": "org.openjfx", - "artifactId": "javafx-controls", - "version": "17", - "sha1": { - "linux": "851a1896fbd8548fb3671aa689b305b2cfad956a", - "linux-arm32-monocle": "9add14fda362a1a2d1cd3a84de60d67da2d7a5ae", - "linux-aarch64": "eb4116ebad81183980dde74b072a15b0f6c795ef", - "mac": "e73acf695ffccb4f904ff7b76de8999eefb547c2", - "mac-aarch64": "2254b351c1e6ce2ac9adcd3480fed883cebbb08b", - "win": "efc0f4edde079c22987064922530c67fa1350a9b", - "win-x86": "c9997e885f2dd71d8a4a7b89bc510923d2d412d6" - } - }, - { - "module": "javafx.fxml", - "groupId": "org.openjfx", - "artifactId": "javafx-fxml", - "version": "17", - "sha1": { - "linux": "0a6f029f4fab0f01f00a838de1e65e20c6a92f02", - "linux-arm32-monocle": "922b73ca1813dfa87e66613d2904286bdd06e7f1", - "linux-aarch64": "7cd2f92f399f48acedc85636c9f07f6634d29669", - "mac": "54026a476bb95426e2e159bcf25bbf0832d2b7bf", - "mac-aarch64": "09ba33b0d9c19e9dcfd76fe7d95748a933e09b3b", - "win": "08d79ed85fa9dde644d4b37d93a02a2ef2818769", - "win-x86": "3bde4e98cee0a464f327b9e983aded3017fddbc0" - } - }, - { - "module": "javafx.media", - "groupId": "org.openjfx", - "artifactId": "javafx-media", - "version": "17", - "sha1": { - "linux": "e3bb829ce1447a37a8b0b669a446e0414e54e5c7", - "linux-aarch64": "7e7a50e66e44b902c624680601d5336d7fd16614", - "mac": "ef463caf627c4c97b8e5c6a5ae16050c56aed966", - "mac-aarch64": "970178b32e17650591698bae9f23bf5ce1295bb6", - "win": "6012cc30ced1539f167b64959cb9d6a4283f7aa7", - "win-x86": "8568e1edcfc803a75349124b21a27c0d609b3870" - } - }, - { - "module": "javafx.web", - "groupId": "org.openjfx", - "artifactId": "javafx-web", - "version": "17", - "sha1": { - "linux": "bbd71beaf561b72f0d3eb6268d3114573b7799c3", - "linux-aarch64": "3cd86d9593e63ce7cbd5f9b5a09f8dcc0bbd7fdb", - "mac": "bf188c003e54ffb4cff6a9be7ce437fa269964fe", - "mac-aarch64": "a9408d443fa95cd3e2b1f170a3abeaace33d3af5", - "win": "be4a308dbcc947af2a9d9c42a72fd7f6d0ba77b9", - "win-x86": "3d93e1801c720747d4551de26ef5869ff9eacabc" - } - } -] \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0161ac284..67449e0db 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -112,7 +112,7 @@ val jfxClassifier = listOf( ) val jfxVersion = "17" val jfxMirrorRepos = listOf("https://maven.aliyun.com/repository/central") -val jfxDependenciesFile = rootProject.file("HMCL/src/main/resources/assets/openjfx-dependencies.json") +val jfxDependenciesFile = project("HMCL").buildDir.resolve("openjfx-dependencies.json") val jfxUnsupported = mapOf( "linux-arm32-monocle" to listOf("media", "web") ) @@ -157,6 +157,8 @@ if (!jfxInClasspath && JavaVersion.current() >= JavaVersion.VERSION_11) { } rootProject.tasks.create("generateOpenJFXDependencies") { + outputs.file(jfxDependenciesFile) + doLast { val jfxDependencies = jfxModules.map { module -> linkedMapOf( @@ -172,6 +174,7 @@ rootProject.tasks.create("generateOpenJFXDependencies") { ) } + jfxDependenciesFile.parentFile.mkdirs() jfxDependenciesFile.writeText( com.google.gson.GsonBuilder().setPrettyPrinting().create().toJson(jfxDependencies) )