-
Notifications
You must be signed in to change notification settings - Fork 330
Milestone
Description
I have a gradle plugin that tries to conditionally enable KSP and add relevant KSP processors to it. However, I found that KSP's task registration can be unintentionally deleted by a simple project.afterEvaluate
in gradle, resulting in the task never being registered and thus not run.
Example
// in build.gradle.kts, or a gradle plugin
project.afterEvaluate {
if (enableKsp) {
pluginManager.apply("com.google.devtools.ksp")
dependencies.add("ksp", "some.ksp:processor:1.0.0")
}
}
will result in KSP being applied but no ksp*Kotlin
task ever being registered and thus never running. If I add any dependency to the ksp
configuration (even one without any KSP processors in it), it works and picks up the later-added dependency too.
I think I would expect this to always register the KSP task, then conditionally no-op at task-action-time rather than try to conditionally avoid adding the task.
Metadata
Metadata
Assignees
Labels
No labels