Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
excludedSources
to the KSP extension
This new property allows users to create a Gradle task that generates Kotlin code, which can then get excluded by KSP's processing step. This can help avoid circular Gradle dependency issues, such as in the case where KSP generates an intermediate file (like a resource) which a Gradle plugin then consumes and uses to generate its own Kotlin source. Without this change, KSP would want to rerun when the new source got generated, which upsets Gradle because it already ran. The following is one example of using the `excludedSources` property: ```kotlin val generateCodeTask = tasks.register("generateCodeTask") { val outputDir = project.layout.buildDirectory.dir("generated/src") outputs.dir(outputDir) doLast { /* ... generate code into outputDir ... */ } } ksp.excludedSources.from(generateCodeTask) kotlin { sourceSets.main { kotlin.srcDir(generateCodeTask) } } ``` Bug #1791 Co-authored-by: David Herman <bitspittle@gmail.com> Co-authored-by: Dennis Tsar <45399002+DennisTsar@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
18 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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