2022-01-01 13:43:54 +08:00
|
|
|
plugins {
|
|
|
|
|
`java-library`
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-25 16:05:09 +08:00
|
|
|
tasks.withType<JavaCompile> {
|
2025-09-11 15:51:04 +08:00
|
|
|
sourceCompatibility = "17"
|
|
|
|
|
targetCompatibility = "17"
|
2025-07-25 16:05:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tasks.compileJava {
|
|
|
|
|
options.compilerArgs.add("--add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED")
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-01 13:43:54 +08:00
|
|
|
dependencies {
|
2025-04-29 13:41:45 +08:00
|
|
|
api(libs.kala.compress.zip)
|
|
|
|
|
api(libs.kala.compress.tar)
|
2026-07-26 00:47:43 +08:00
|
|
|
api(libs.kala.encoding.detctor)
|
2025-04-29 13:41:45 +08:00
|
|
|
api(libs.simple.png.javafx)
|
|
|
|
|
api(libs.gson)
|
2026-04-20 21:35:47 +08:00
|
|
|
api(libs.tomlj)
|
2025-04-29 13:41:45 +08:00
|
|
|
api(libs.xz)
|
2026-03-21 22:57:52 +08:00
|
|
|
api(libs.lz4)
|
2025-04-29 13:41:45 +08:00
|
|
|
api(libs.fx.gson)
|
|
|
|
|
api(libs.constant.pool.scanner)
|
|
|
|
|
api(libs.nanohttpd)
|
|
|
|
|
api(libs.jsoup)
|
2025-05-04 22:31:50 +08:00
|
|
|
api(libs.jna)
|
2025-05-09 10:08:08 +08:00
|
|
|
api(libs.pci.ids)
|
2026-03-21 22:57:52 +08:00
|
|
|
api(libs.hello.nbt)
|
2026-05-12 21:43:19 +08:00
|
|
|
api(libs.weburl)
|
2026-06-19 11:05:24 +08:00
|
|
|
api(libs.uuid.tools)
|
2026-08-05 21:56:48 +08:00
|
|
|
api(libs.commonmark)
|
|
|
|
|
api(libs.commonmark.autolink)
|
|
|
|
|
api(libs.commonmark.underline)
|
|
|
|
|
api(libs.commonmark.strikethrough)
|
|
|
|
|
api(libs.commonmark.table)
|
|
|
|
|
|
2025-04-29 13:41:45 +08:00
|
|
|
compileOnlyApi(libs.jetbrains.annotations)
|
2025-05-14 22:18:02 +08:00
|
|
|
|
|
|
|
|
testImplementation(libs.jna.platform)
|
2025-09-04 15:51:17 +08:00
|
|
|
testImplementation(libs.jimfs)
|
2022-01-01 13:43:54 +08:00
|
|
|
}
|
2025-09-14 20:50:53 +08:00
|
|
|
|
|
|
|
|
tasks.processResources {
|
2026-11-01 21:10:33 +08:00
|
|
|
mustRunAfter("updateClientSha1")
|
|
|
|
|
|
2025-09-14 20:50:53 +08:00
|
|
|
listOf(
|
|
|
|
|
"HMCLTransformerDiscoveryService",
|
|
|
|
|
"HMCLMultiMCBootstrap"
|
|
|
|
|
).map { project(":$it").tasks["jar"] as Jar }.forEach { task ->
|
|
|
|
|
dependsOn(task)
|
|
|
|
|
|
|
|
|
|
into("assets/game") {
|
|
|
|
|
from(task.outputs.files)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-09-30 20:26:28 +08:00
|
|
|
|
2026-11-01 21:10:33 +08:00
|
|
|
tasks.register("updateClientSha1", org.jackhuang.hmcl.gradle.component.UpdateClientSha1::class) {
|
|
|
|
|
description = "Update the embedded Minecraft client SHA-1 table"
|
|
|
|
|
|
|
|
|
|
unlistedVersionsFile.set(layout.projectDirectory.file("src/main/resources/assets/game/unlisted-versions.json"))
|
|
|
|
|
outputFile.set(layout.projectDirectory.file("src/main/resources/assets/game/client-sha1.csv"))
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 20:26:28 +08:00
|
|
|
tasks.register("updateLiteLoaderVersionList", org.jackhuang.hmcl.gradle.component.UpdateLiteLoaderVersionList::class) {
|
|
|
|
|
description = "Update LiteLoader version list"
|
|
|
|
|
|
|
|
|
|
outputFile.set(projectDir.resolve("src/main/resources/assets/liteloader/versions.json"))
|
|
|
|
|
}
|
2026-10-29 02:37:36 +08:00
|
|
|
|
|
|
|
|
tasks.register("updateAmdGpuIDs") {
|
|
|
|
|
description = "Update AMD GPU IDs"
|
|
|
|
|
|
|
|
|
|
val commit = "3b5e41a44cd1842297e17447c3984c85c2a6d837"
|
|
|
|
|
|
|
|
|
|
val sourceUrl = uri("https://gitlab.freedesktop.org/mesa/libdrm/-/raw/$commit/data/amdgpu.ids")
|
|
|
|
|
val outputFile = projectDir.resolve("src/main/resources/assets/platform/amdgpu.ids")
|
|
|
|
|
outputs.file(outputFile)
|
|
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
outputFile.parentFile.mkdirs()
|
|
|
|
|
|
|
|
|
|
val rawContent = sourceUrl.toURL().readText()
|
|
|
|
|
|
|
|
|
|
outputFile.bufferedWriter().use { writer ->
|
|
|
|
|
writer.write("# https://gitlab.freedesktop.org/mesa/libdrm/-/blob/$commit/data/amdgpu.ids\n")
|
|
|
|
|
writer.write("#\n")
|
|
|
|
|
|
|
|
|
|
val linePattern = """(?<deviceId>[0-9A-F]{4}),\s+(?<revisionId>[0-9A-Z]{2}),\s+(?<productName>.+)""".toPattern()
|
|
|
|
|
|
|
|
|
|
val lines = rawContent.lines()
|
|
|
|
|
lines.forEachIndexed { index, line ->
|
|
|
|
|
val normalized = line
|
|
|
|
|
// Replace non-breaking space with normal space
|
|
|
|
|
.replace('\u00A0', ' ')
|
|
|
|
|
// Replace narrow non-breaking space with normal space
|
|
|
|
|
.replace('\u202f', ' ')
|
|
|
|
|
.trim()
|
|
|
|
|
.let {
|
|
|
|
|
val matcher = linePattern.matcher(it)
|
|
|
|
|
if (matcher.matches()) {
|
|
|
|
|
val deviceId = matcher.group("deviceId")
|
|
|
|
|
val revisionId = matcher.group("revisionId")
|
|
|
|
|
val productName = matcher.group("productName")
|
|
|
|
|
|
|
|
|
|
"$deviceId,\t$revisionId,\t$productName"
|
|
|
|
|
} else {
|
|
|
|
|
it
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normalized.isNotEmpty() || index != lines.lastIndex) {
|
|
|
|
|
writer.write(normalized)
|
|
|
|
|
writer.write("\n")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-11-01 21:10:33 +08:00
|
|
|
}
|