google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.89k stars 274 forks source link

Project Isolation: Project cannot access task dependencies directly #1943

Open consp1racy opened 5 months ago

consp1racy commented 5 months ago

buildDependencies.getDependencies(null) isn't compatible with Project Isolation.

⌄⨉Project :app cannot access task dependencies directly ⌄plugin 'org.jetbrains.kotlin.android' ›Exception at com.google.devtools.ksp.gradle.KspGradleSubplugin.applyToCompilation$configureAsAbstractKotlinCompileTool(KspSubplugin.kt:322) ›Exception at com.google.devtools.ksp.gradle.KspSubpluginKt.nonSelfDeps(KspSubplugin.kt:864)

https://github.com/google/ksp/blob/d8efe453f331f0568ffc8c3f2f64a1cbbd951a81/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt#L300-L332

https://github.com/google/ksp/blob/d8efe453f331f0568ffc8c3f2f64a1cbbd951a81/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt#L863-L866

https://github.com/gradle/gradle/blob/master/platforms/core-configuration/configuration-cache/src/main/kotlin/org/gradle/configurationcache/ReportingTaskDependencyUsageTracker.kt

I'm looking for a PI-compatible alternative API. Or waiting for the Gradle team to make the exiting API compatible ^^


Reading properties from parent projects can be prevented by assigning same-named extras on every project using KSP. That's another problem, that can already be worked around.

martinbonnin commented 4 months ago

+1 to this issue. Bellow a configuration cache reports that lists cannot access task dependencies directly issues as well as cannot dynamically look up a property in the parent project on ksp.experimental.processing.model and a bunch of others.

cache-report.zip

ansman commented 1 week ago

The cannot dynamically look up a property in the parent project errors have been fixed in #2034