Skip to content

Commit 79da12b

Browse files
committed
Workaround for locked cache directory on Windows
Picked the workaround from kotlinx-datetime
1 parent bba9aea commit 79da12b

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

benchmarks/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.konan.target.KonanTarget
1010
plugins {
1111
kotlin("multiplatform")
1212
alias(libs.plugins.kotlinx.benchmark.plugin)
13+
id("kotlinx-io-clean")
1314
}
1415

1516
kotlin {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import org.gradle.api.tasks.Delete
2+
import org.gradle.kotlin.dsl.invoke
3+
import org.gradle.kotlin.dsl.named
4+
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
5+
6+
/*
7+
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
8+
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
9+
*/
10+
if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows) {
11+
tasks {
12+
// Workaround for https://youtrack.jetbrains.com/issue/KT-58303:
13+
// the `clean` task can't delete the expanded.lock file on Windows as it's still held by Gradle, failing the build
14+
named("clean", Delete::class) {
15+
setDelete(fileTree(buildDir) {
16+
exclude("tmp/.cache/expanded/expanded.lock")
17+
})
18+
}
19+
}
20+
}

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENCE file.
44
*/
55

6-
import org.gradle.kotlin.dsl.kotlin
76
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
87
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
98
import kotlin.jvm.optionals.getOrNull
109

1110
plugins {
1211
kotlin("multiplatform")
12+
id("kotlinx-io-clean")
1313
}
1414

1515
kotlin {

0 commit comments

Comments
 (0)