Skip to content

Commit bceba05

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

File tree

3 files changed

+23
-1
lines changed

3 files changed

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

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)