tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
Mozilla Public License 2.0
658 stars 63 forks source link

Can't find place of storing generated files by ksp #290

Open Coolmanakov opened 2 years ago

Coolmanakov commented 2 years ago

Here is my code

val compilation = KotlinCompilation().apply { sources = listOf(sourceFile) symbolProcessorProviders = listOf(KspProvider()) inheritClassPath = true kspWithCompilation = true workingDir = File(testWorkingDir) } compilationResult = compilation.compile()

compilationResult.generatedFiles contains necessary files, but they are compiled equivalent of what I really need, that's why I can not compare them with expected But I have generated files in build/generated/ksp/..., but KotlinCompilation.Result property sourcesGeneratedByAnnotationProcessor is empty. It means, that generating is working fine, but access to them impossible thing - in my experience. How can I take the generated files while testing my processor? My issue has the same problem as already opened issue https://github.com/tschuchortdev/kotlin-compile-testing/issues/129

micHar commented 2 years ago

See this for file location: https://github.com/tschuchortdev/kotlin-compile-testing/issues/129 And this to access compiled classes: https://github.com/tschuchortdev/kotlin-compile-testing/issues/72#issuecomment-744475289

micHar commented 2 years ago

My understanding is that this lib is not fully compatible with ksp yet. Methods and properties like generatedFiles work fine for kapt, but for ksp you need a little duct tape ;).