-
Notifications
You must be signed in to change notification settings - Fork 362
Description
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)
ksp/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt
Lines 300 to 332 in d8efe45
| if (kspExtension.allowSourcesFromOtherPlugins) { | |
| fun setSource(source: FileCollection) { | |
| // kspTask.setSource(source) would create circular dependency. | |
| // Therefore we need to manually extract input deps, filter them, and tell kspTask. | |
| kspTask.setSource(project.provider { source.files }) | |
| kspTask.dependsOn(project.provider { source.nonSelfDeps(kspTaskName) }) | |
| } | |
| setSource( | |
| kotlinCompileTask.sources.filter { | |
| !kotlinOutputDir.isParentOf(it) && !javaOutputDir.isParentOf(it) | |
| } | |
| ) | |
| if (kotlinCompileTask is KotlinCompile) { | |
| setSource( | |
| kotlinCompileTask.javaSources.filter { | |
| !kotlinOutputDir.isParentOf(it) && !javaOutputDir.isParentOf(it) | |
| } | |
| ) | |
| } | |
| } else { | |
| val filteredTasks = | |
| kspExtension.excludedSources.buildDependencies.getDependencies(null).map { it.name } | |
| kotlinCompilation.allKotlinSourceSetsObservable.forAll { sourceSet -> | |
| kspTask.setSource( | |
| sourceSet.kotlin.srcDirs.filter { | |
| !kotlinOutputDir.isParentOf(it) && !javaOutputDir.isParentOf(it) && | |
| it !in kspExtension.excludedSources | |
| } | |
| ) | |
| kspTask.dependsOn(sourceSet.kotlin.nonSelfDeps(kspTaskName).filter { it.name !in filteredTasks }) | |
| } | |
| } |
ksp/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspSubplugin.kt
Lines 863 to 866 in d8efe45
| internal fun FileCollection.nonSelfDeps(selfTaskName: String): List<Task> = | |
| buildDependencies.getDependencies(null).filterNot { | |
| it.name == selfTaskName | |
| } |
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.