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