2018-12-08 21:00:23 +08:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
2021-08-20 15:58:44 +08:00
|
|
|
mavenCentral()
|
2018-12-08 21:00:23 +08:00
|
|
|
maven { url 'https://plugins.gradle.org/m2/' }
|
|
|
|
}
|
2021-09-07 19:41:57 +08:00
|
|
|
dependencies {
|
|
|
|
classpath group: 'com.google.code.gson', name: 'gson', version: '2.8.1'
|
|
|
|
}
|
2018-12-08 21:00:23 +08:00
|
|
|
}
|
|
|
|
|
2021-05-30 03:34:44 +08:00
|
|
|
plugins {
|
|
|
|
id 'checkstyle'
|
|
|
|
}
|
|
|
|
|
2018-12-08 21:00:23 +08:00
|
|
|
group 'org.jackhuang'
|
|
|
|
version '3.0'
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'idea'
|
2020-08-11 11:25:23 +08:00
|
|
|
apply plugin: 'maven-publish'
|
2021-05-30 03:34:44 +08:00
|
|
|
apply plugin: 'checkstyle'
|
2018-12-08 21:00:23 +08:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
|
|
|
|
maven { url 'https://jitpack.io' }
|
|
|
|
}
|
|
|
|
|
2021-07-10 22:44:13 +08:00
|
|
|
checkstyle {
|
|
|
|
sourceSets = []
|
|
|
|
}
|
|
|
|
|
2018-12-08 21:00:23 +08:00
|
|
|
sourceCompatibility = 1.8
|
|
|
|
compileJava.options.encoding = "UTF-8"
|
|
|
|
compileTestJava.options.encoding = "UTF-8"
|
|
|
|
|
|
|
|
dependencies {
|
2021-04-29 15:00:34 +08:00
|
|
|
testImplementation group: 'junit', name: 'junit', version: '4.12'
|
2018-12-08 21:00:23 +08:00
|
|
|
}
|
|
|
|
|
2020-08-11 11:25:23 +08:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
maven(MavenPublication) {
|
|
|
|
from components.java
|
|
|
|
}
|
|
|
|
}
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
}
|
|
|
|
}
|
2018-12-08 21:00:23 +08:00
|
|
|
}
|
2019-01-05 18:49:28 +08:00
|
|
|
|
|
|
|
defaultTasks 'clean', 'build'
|
2021-09-07 19:41:57 +08:00
|
|
|
|
2021-09-08 09:13:33 +08:00
|
|
|
var jfxModules = ['base', 'graphics', 'controls', 'fxml', 'media', 'web']
|
2021-09-07 20:07:11 +08:00
|
|
|
var jfxArches = ['linux', 'linux-arm32-monocle', 'linux-aarch64', 'mac', 'mac-aarch64', 'win', 'win-x86']
|
2021-09-08 09:13:33 +08:00
|
|
|
var jfxVersion = "17"
|
2021-09-07 21:35:35 +08:00
|
|
|
var jfxRepos = ['https://repo1.maven.org/maven2', 'https://maven.aliyun.com/repository/central']
|
|
|
|
var jfxDependenciesFile = file('HMCL/src/main/resources/assets/openjfx-dependencies.json')
|
|
|
|
|
|
|
|
import com.google.gson.*
|
2021-09-07 19:41:57 +08:00
|
|
|
|
|
|
|
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 ->
|
2021-09-07 21:35:35 +08:00
|
|
|
if (module == 'web' && arch.endsWith('linux-arm32-monocle')) {
|
|
|
|
return
|
2021-09-07 19:41:57 +08:00
|
|
|
}
|
2021-09-07 21:35:35 +08:00
|
|
|
sha1.addProperty(
|
|
|
|
arch,
|
|
|
|
new URL("${jfxRepos[0]}/org/openjfx/javafx-$module/$jfxVersion/javafx-$module-$jfxVersion-${arch}.jar.sha1").getText("UTF-8")
|
|
|
|
)
|
2021-09-07 19:41:57 +08:00
|
|
|
}
|
|
|
|
m.add("sha1", sha1)
|
|
|
|
|
|
|
|
jfxDependencies.add(m)
|
|
|
|
}
|
|
|
|
|
2021-09-07 21:35:35 +08:00
|
|
|
jfxDependenciesFile.text = new GsonBuilder().setPrettyPrinting().create().toJson(jfxDependencies)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that the mirror repository caches files
|
|
|
|
task 'preTouchOpenJFXDependencies' {
|
|
|
|
doLast {
|
|
|
|
jfxRepos.forEach { repo ->
|
|
|
|
jfxModules.forEach { module ->
|
|
|
|
jfxArches.forEach { arch ->
|
|
|
|
if (module == 'web' && arch.endsWith('linux-arm32-monocle')) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
var jarUrl = "$repo/org/openjfx/javafx-$module/$jfxVersion/javafx-$module-$jfxVersion-${arch}.jar"
|
|
|
|
|
|
|
|
[jarUrl, jarUrl + ".sha1"].forEach { url ->
|
|
|
|
try {
|
|
|
|
new URL(url).getBytes()
|
|
|
|
System.out.println(url)
|
|
|
|
} catch (Throwable ignored) {
|
|
|
|
ignored.printStackTrace()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-07 19:41:57 +08:00
|
|
|
}
|
|
|
|
}
|