Make KSP compatible with Gradle's isolated projects#2315
Open
scott-pollom wants to merge 1 commit intogoogle:mainfrom
Open
Make KSP compatible with Gradle's isolated projects#2315scott-pollom wants to merge 1 commit intogoogle:mainfrom
scott-pollom wants to merge 1 commit intogoogle:mainfrom
Conversation
WIP Bug: https://issuetracker.google.com/issues/361415637 Test: AndroidIT.kt
26b2e00 to
ba5efd4
Compare
ting-yuan
reviewed
Feb 3, 2025
| // They will be observed by downstreams and violate current build scheme. | ||
| kotlinCompileProvider.configure { it.source(*generatedSources) } | ||
| } else { | ||
| kotlinCompilation.defaultSourceSet.kotlin.srcDirs(*generatedSources) |
Collaborator
There was a problem hiding this comment.
The reason for adding generated sources to kotlinCompilation.defaultSourceSet and all corresponding workarounds is IDE support, which is not covered in KSP's tests unfortunately. Without this, users would add the output folder of KSP to the source set and suffer from the same (if not more) issue.
I got a couple of alternatives but they are apparently beyond the scope of this PR.
- Work with KGP / JetBrains to get an API for registering generated sources, like those provided by AGP.
- Implement IDE plugins for KSP.
Are there easier solutions?
Contributor
Author
There was a problem hiding this comment.
Are there easier solutions?
I can't think of a way to make it work with existing APIs.
There was a problem hiding this comment.
Now that Kotlin provides a new API for registering generated sources in Gradle projects, could it be fixed with ?
kotlinCompilation.defaultSourceSet.generatedKotlin.srcDir(kspTaskProvider.map { kotlinOutputDir.get().asFile })
kotlinCompilation.defaultSourceSet.generatedKotlin.srcDir(kspTaskProvider.map { javaOutputDir.get().asFile })
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
Bug: https://issuetracker.google.com/issues/361415637
Test: AndroidIT.kt