fix: resolve configuration cache issue in processLspResources task

Changed processLspResources from a generic task with doLast block to a proper Copy task. This eliminates Gradle script object references that were incompatible with configuration cache.

- Converted to Copy task type
- Moved copy logic from doLast to task configuration
- Maintains same functionality while being configuration cache compatible
This commit is contained in:
me
2026-01-29 15:04:36 +08:00
parent 5203c1791c
commit 17da3f6f0e

View File

@@ -77,30 +77,24 @@ tasks {
onlyIfModified(true)
}
}
val processLspResources by registering {
val processLspResources by registering(Copy::class) {
dependsOn(downloadTasks)
inputs.dir(downloadDir)
outputs.dir(extractedDir)
doLast {
slintViewerFilenames.forEach { (filename, renamed) ->
val fileTarget = downloadDir.get().file(filename)
copy {
val fileTree = if (filename.endsWith("zip")) zipTree(fileTarget) else tarTree(fileTarget)
from(fileTree) {
// 匹配压缩包内的 slint-lsp 文件夹及其内容
include("**/slint-lsp*")
// 展平目录并重命名
eachFile {
path = renamed
}
includeEmptyDirs = false
}
into(extractedDir)
slintViewerFilenames.forEach { (filename, renamed) ->
val fileTarget = downloadDir.get().file(filename)
val fileTree = if (filename.endsWith("zip")) zipTree(fileTarget) else tarTree(fileTarget)
from(fileTree) {
// 匹配压缩包内的 slint-lsp 文件夹及其内容
include("**/slint-lsp*")
// 展平目录并重命名
eachFile {
path = renamed
}
includeEmptyDirs = false
}
}
into(extractedDir)
}
prepareSandbox {
dependsOn(processLspResources)