ychescale9 / ksp-incremental-bug

Reproduce a KSP incremental processing bug

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reproduce KSP incremental processing bug when touching unrelated source files

This repo reproduces a bug where KSP incremental processing fails to generate code when touching unrelated source files.

Project setup

  • :annotations an annotation class with AnnotationTarget.CLASS and a KClass<*> argument
  • :test-processor a simple KSP processor that returns the list of properties of the annotated target
  • :ksp-consumer A Kotlin JVM project that adds source code generated by Apollo to the main sourceset for the :test-processor to process.

Steps to reproduce

  1. Compile the project with KSP processor for the first time: ./gradlew ksp-consumer:compileKotlin
  2. Make any changes to AnotherFile.kt e.g. adding a space character.
  3. Compile again: ./gradlew ksp-consumer:compileKotlin

The compilation will fail with KspConsumer.kt:10:31 Unresolved reference: properties where properties is the extension function generated by the KSP processor.

This won't happen with ./gradlew ksp-consumer:compileKotlin -Pksp.incremental=false.

This also won't happen if touching KspConsumer.kt which has the annotation entrypoint for the KSP processor.

About

Reproduce a KSP incremental processing bug


Languages

Language:Kotlin 100.0%