Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KSP2: Calling KSP2 in programs does not appear to work on macOS or Windows #1908

Closed
ZacSweers opened this issue May 21, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@ZacSweers
Copy link
Contributor

ZacSweers commented May 21, 2024

It looks like something changed in 1.0.21 around file module ownership. I looked at the “Calling KSP2 in Programs” docs and they don’t mention anything specific for setting up modules. When I look in the debugger, I do see a module there, but I’m not able to breakpoint it (it appears the class files don’t match published sources). Functionally, it just doesn’t seem to match the contains call when it checks if the virtual file is in the module’s content scope.

This effectively breaks compile testing KSP plugins as well as I’m not able to figure out a workaround. PR is here: ZacSweers/kotlin-compile-testing#196
logging: No services were given. Not running kapt steps.

v: [ksp] round 1 of processing
Cannot find a KtModule for the VirtualFile
ksp.org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments: Cannot find a KtModule for the VirtualFile
	at ksp.org.jetbrains.kotlin.analysis.project.structure.impl.KtStandaloneProjectStructureProvider.getModule(KtStandaloneProjectStructureProvider.kt:62)
	at ksp.org.jetbrains.kotlin.analysis.project.structure.ProjectStructureProvider$Companion.getModule(ProjectStructureProvider.kt:105)
	at ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.api.LLFirResolveSessionKt.getModule(LLFirResolveSession.kt:103)
	at ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirResolvableResolveSession.getModuleComponentsForElement(LLFirResolvableResolveSession.kt:56)
	at ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirResolvableResolveSession.getOrBuildFirFile$low_level_api_fir(LLFirResolvableResolveSession.kt:51)
	at ksp.org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeKt.getOrBuildFirFile(LowLevelFirApiFacade.kt:137)
	at ksp.org.jetbrains.kotlin.analysis.api.fir.symbols.KtFirSymbolProvider.getFileSymbol(KtFirSymbolProvider.kt:57)
	at ksp.org.jetbrains.kotlin.analysis.api.symbols.KtSymbolProviderMixIn.getFileSymbol(KtSymbolProvider.kt:137)
	at com.google.devtools.ksp.impl.KotlinSymbolProcessing.prepareNewKSFiles(KotlinSymbolProcessing.kt:403)
	at com.google.devtools.ksp.impl.KotlinSymbolProcessing.execute(KotlinSymbolProcessing.kt:552)
	at com.tschuchort.compiletesting.Ksp2PrecursorTool.execute(Ksp2.kt:116)

image

@ZacSweers ZacSweers changed the title KSP2: Calling KSP2 in programs does not appear to work KSP2: Calling KSP2 in programs does not appear to work on macOS or Windows May 22, 2024
@neetopia neetopia self-assigned this May 23, 2024
@neetopia neetopia added the bug Something isn't working label May 23, 2024
@neetopia
Copy link
Contributor

This issue should be fixed by #1925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants