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

can't find ksp generated code #1

Open
Zane-XY opened this issue Feb 28, 2024 · 1 comment
Open

can't find ksp generated code #1

Zane-XY opened this issue Feb 28, 2024 · 1 comment
Assignees

Comments

@Zane-XY
Copy link

Zane-XY commented Feb 28, 2024

Using the below configuration, I can see the AutoKtmAdaptersModule is generated. But my project can't find it, even I've added

dependencies {
    add("kspJvm", "net.orandja.ktm:ksp:0.0.2")
}
val commonMain by getting {
            kotlin.srcDir("build/generated/ksp/jvm/jvmMain/kotlin")
}

or

jvmMain {
            kotlin.srcDir("build/generated/ksp/jvm/jvmMain/kotlin")
}

The compiler plugin seems to output each target in their own generated source dirs. But the usage of the AutoKtmAdaptersModule is from a commonMain sourceSet.

updates:

i get this working by defining an expect function in the commonMain,

expect fun initKtm()

and implemented it in each target:

Ktm.setDefaultAdapters(AutoKtmAdaptersModule)

This is not on the documentation though, is this the correct way? Can I just generate it as commonMain source?

@L-Briand
Copy link
Owner

L-Briand commented Feb 28, 2024

Hello

is this the correct way?

Yes, this is the correct behavior and way to declare adapters.

Can I just generate it as commonMain source?

I don't know why but the KSP plugin do not allow to generate code for the common target. Even if the generated code is common compatible. I can't do anything about it, it is a limitation on KSP itself.

I'm working alone on this project and you are right this is a bit confusing for new people wanting to use the lib. I'll add some documentation about it. If you have some remarks on how to improve the lib, please tell.

@L-Briand L-Briand self-assigned this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants