From 5044d4fa016bb269d8670c369be19bb76c971e10 Mon Sep 17 00:00:00 2001 From: Ting-Yuan Huang Date: Tue, 29 Aug 2023 12:13:18 -0700 Subject: [PATCH] AA: Clean stale outputs before running --- .../main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt index b9791a3041..37e96f08ed 100644 --- a/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt +++ b/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt @@ -174,6 +174,12 @@ interface KspAAWorkParameter : WorkParameters { abstract class KspAAWorkerAction : WorkAction { override fun execute() { val gradleCfg = parameters.config + + // Clean stale files for now. + // TODO: support incremental processing. + gradleCfg.outputBaseDir.get().deleteRecursively() + gradleCfg.cachesDir.get().deleteRecursively() + val processorClassloader = URLClassLoader( gradleCfg.processorClasspath.files.map { it.toURI().toURL() }.toTypedArray(), SymbolProcessorProvider::class.java.classLoader