Zac Sweers
10/16/2025, 6:47 AMtestServices.sourceFileProvider.getContentOfSourceFile(testFile) in AdditionalSourceProvider.produceAdditionalFiles() because it calls through to testServices.moduleStructure under the hood, and seems that's no longer available at that time. I can just call testFile.originalContent directly but that skips other preprocessors.
Worth filing an issue or is there a different API we should be using for this?
java.lang.IllegalStateException: No 'org.jetbrains.kotlin.test.services.TestModuleStructure'(19) in array owner: org.jetbrains.kotlin.test.services.TestServices@7af2910e
at org.jetbrains.kotlin.util.ArrayMapAccessor.getValue(ArrayMapOwner.kt:53)
at org.jetbrains.kotlin.test.services.TestModuleStructureKt.getModuleStructure(TestModuleStructure.kt:22)
at org.jetbrains.kotlin.test.preprocessors.JvmInlineSourceTransformer.process(JvmInlineSourceTransformer.kt:42)
at org.jetbrains.kotlin.test.services.SourceFileProviderImpl.getContentOfSourceFile(SourceFileProvider.kt:63)
at dev.zacsweers.metro.compiler.interop.Ksp2AdditionalSourceProvider.produceAdditionalFiles(Ksp2AdditionalSourceProvider.kt:55)dmitriy.novozhilov
10/20/2025, 7:16 AMseems that's no longer available at that timeIt was always illegal at this time. The thing is that
JvmInlineSourceTransformer is new service which I introduced just recently.
JvmInlineSourceTransformer is very kotlin project specific and the best solution is just don't register it for tests in plugins. But to understand what is the best way to do it I need to know how exactly you setup your tests, what is the base classes for your test runners? Is it AbstractKotlinCompilerTest or you extend more specific runners from the test framework?Zac Sweers
10/20/2025, 8:43 AMZac Sweers
10/20/2025, 8:44 AMdmitriy.novozhilov
10/20/2025, 9:05 AM...Generated tests.bnorm
10/20/2025, 11:37 AMAdditionalSourceProvider originally, as I thought it made the most sense. Thinking it might need to be a separate step now? All 4 of the base tests in the project use it, but not every test needs it. I believe they all extend AbstractKotlinCompilerTest in some way. Here's the diagnostic base test and where the KSP integration gets registered.dmitriy.novozhilov
10/21/2025, 6:04 AMMetroDirectives.enableDaggerKsp(module.directives) check to MetroDirectives.enableDaggerKsp(globalDirectives)
• extract tests with ENABLE_DAGGER_KSP into a separate directory(es)
• remove the directive // ENABLE_DAGGER_KSP from test data files
• register it in the testrunner itself
forTestsMatching("path/to/these/files/*") {
defaultDirectives {
+ENABLE_DAGGER_KSP
}
}