google / google/ksp

Problematic use of Project.detachedConfiguration for KSP2

Open
#1,964 3 comments 1 reaction 0 assignees View on GitHub
Gradle
Dominant language
Kotlin
Stars
3.5k
Forks
415
Avg merge
1d 2h
Merged PRs (30d)
53

Description

KSP2 uses a [detached configuration](https://github.com/google/ksp/blob/e479a7e3917e6947f6690af64c18c38d11c2292f/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KspAATask.kt#L152C1-L161C14) to resolve the `symbol-processing-aa` dependency. This is problematic because detached configurations are not visible during the build's configuration phase, so use cases like the following are made more difficult:

- Tools that aggregate a project's dependencies, such as the [GitHub Dependency Graph Gradle Plugin](https://github.com/gradle/github-dependency-graph-gradle-plugin/) and [gradle2nix](https://github.com/tadfisher/gradle2nix/tree/v2), fail to detect this configuration automatically.
- Overriding dependencies for bug triaging or local development is more difficult; the only ways I can think of is to modify the plugin source or use dependency substitution with an included build.
- The `symbol-processing-aa` dependency doesn't appear in the `dependencies` task.

For this case, I don't believe there is a technical limitation preventing the use of configurations registered at configuration time, as is done with KSP1.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.