You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Sorry it looks like this is actually after two afterEvaluate calls, not just one level. Which is admittedly a somewhat edge case :). That said, still would be nice if there was a way to defer this to task-time instead
Enaium
added a commit
to Enaium-Fork/ksp
that referenced
this issue
Apr 30, 2024
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
will result in KSP being applied but no
ksp*Kotlin
task ever being registered and thus never running. If I add any dependency to theksp
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.
The text was updated successfully, but these errors were encountered: