aboutsummaryrefslogtreecommitdiff
path: root/gradle-plugin
diff options
context:
space:
mode:
authorTing-Yuan Huang <laszio@google.com>2022-04-01 02:13:37 -0700
committerlaszio <ting-yuan@users.noreply.github.com>2022-04-01 12:18:03 -0700
commitf14f10d9ee37f110687f7bf6ec0ea39b43deb3ae (patch)
treec3ff7f9a29a6bc37e31e35c059de15683c261a4e /gradle-plugin
parent938f2ebcdaa32799442c05b5762c2b72cac998bb (diff)
downloadksp-f14f10d9ee37f110687f7bf6ec0ea39b43deb3ae.tar.gz
K/N: delete outputs upfront
In other platforms, outputs are deleted in AbstractKotlinCompile, which is not inherited by K/N.
Diffstat (limited to 'gradle-plugin')
-rw-r--r--gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt8
1 files changed, 8 insertions, 0 deletions
diff --git a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt
index 215a50e8..21585b77 100644
--- a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt
+++ b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt
@@ -808,6 +808,14 @@ abstract class KspTaskNative @Inject constructor(
// new / changed / removed files.
// Long term solution: contribute to upstream to support incremental compilation.
// Short term workaround: declare a @TaskAction function and call super.compile().
+ // Use a name that gets sorted in the front just in case. `_$` is lower, but it might be too hacky.
+ @TaskAction
+ fun _0() {
+ options.get().single { it.key == "kspOutputDir" }.value.let {
+ File(it).deleteRecursively()
+ }
+ super.compile()
+ }
}
// This forces rebuild.