ychescale9 / unittest-ic-error-additional-sourceset-ksp

Reproduce a Kotlin IC bug where incremental build fails when compiling Android unit test that references code generated a KSP processor which takes code generated by other plugins as input.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reproduce Kotlin IC bug with KSP

This repo reproduces a bug where incremental build fails when compiling Android unit test that references code generated a KSP processor which takes code generated by other plugins as input.

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 An Android library project that adds source code generated by Apollo to the main sourceset for the :test-processor to process. It has a KspConsumerTest which demonstrates the IC bug.

Steps to reproduce

  1. Compile the test for the first time: ./gradlew ksp-consumer:compileDebugUnitTestKotlin
  2. Make any changes to KspConsumerTest.kt e.g. adding a space character.
  3. Compile the test again: ./gradlew ksp-consumer:compileDebugUnitTestKotlin

The compilation will fail with Cannot access class 'com.example.icbug.DogsQuery.Dog'. Check your module classpath for missing or conflicting dependencies.

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

About

Reproduce a Kotlin IC bug where incremental build fails when compiling Android unit test that references code generated a KSP processor which takes code generated by other plugins as input.


Languages

Language:Kotlin 100.0%