diff --git a/build.gradle b/build.gradle index 64219ae39..14f0c33ca 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,13 @@ +import com.google.gson.* + buildscript { repositories { mavenCentral() maven { url 'https://plugins.gradle.org/m2/' } } + dependencies { + classpath group: 'com.google.code.gson', name: 'gson', version: '2.8.1' + } } plugins { @@ -49,3 +54,37 @@ subprojects { } defaultTasks 'clean', 'build' + +var jfxModules = ['base', 'controls', 'fxml', 'graphics', 'media', 'web'] +var jfxArches = ['linux', /*'linux-arm32-monocle',*/ 'linux-aarch64', 'mac', 'mac-aarch64', 'win', 'win-x86'] +var jfxVersion = "17-ea+17" + +task 'generateOpenJFXDependencies' { + doLast { + var jfxDependencies = new JsonArray() + + jfxModules.forEach { module -> + JsonObject m = new JsonObject() + m.addProperty("module", "javafx.$module") + m.addProperty("groupId", "org.openjfx") + m.addProperty("artifactId", "javafx-$module") + m.addProperty("version", jfxVersion) + + var sha1 = new JsonObject() + jfxArches.forEach { arch -> + if (!(module == 'web' && arch.endsWith('linux-arm32-monocle'))) { + sha1.addProperty( + arch, + new URL("https://repo1.maven.org/maven2/org/openjfx/javafx-$module/$jfxVersion/javafx-$module-$jfxVersion-${arch}.jar.sha1").getText("UTF-8") + ) + } + } + m.add("sha1", sha1) + + jfxDependencies.add(m) + } + + file('HMCL/src/main/resources/assets/openjfx-dependencies.json').text = + new GsonBuilder().setPrettyPrinting().create().toJson(jfxDependencies) + } +} \ No newline at end of file diff --git a/tools/generate-openjfx-dependencies.sh b/tools/generate-openjfx-dependencies.sh deleted file mode 100755 index 8a810e087..000000000 --- a/tools/generate-openjfx-dependencies.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -e - -modules=(base controls fxml graphics media web) -arches=(linux linux-aarch64 mac mac-aarch64 win win-x86) -version=17-ea+17 - -echo '[' -for module in ${modules[@]}; do - if [[ ! "$module" == "${modules[0]}" ]]; then - echo ',' - fi - echo ' {' - echo ' "module": "javafx.'$module'",' - echo ' "groupId": "org.openjfx",' - echo ' "artifactId": "javafx-'$module'",' - echo ' "version": "'$version'",' - echo ' "sha1": {' - for arch in ${arches[@]}; do - if [[ ! "$arch" == "${arches[0]}" ]]; then - echo ',' - fi - echo -n ' "'$arch'": "'$(curl -Ss "https://repo1.maven.org/maven2/org/openjfx/javafx-$module/$version/javafx-$module-$version-$arch.jar.sha1")'"' - done - echo - echo ' }' - echo -n ' }' -done -echo -echo ']'