Is it currently possible to use KSP to process com...
# ksp
f
Is it currently possible to use KSP to process common code? There is no configuration for
kspCommonMain
, and doing add("kspCommonMainMetadata",...) does not cause a `kspCommonMain`/metadata task to execute on build of one of the platforms. I don't see any such task being generated either.
Okay, if you only have one platform the task won't exist
Doesn't run though
m
What do you mean by “doesn’t run”?
you should have a
kspCommonMainKotlinMetadata
task
We’re doing it successfully here
(Anecdotally, I got hit yesterday with a problem when there is a single
jvm
platform but I don’t think it’s the same problem here)
e
m
The IDE completion is still not working right?
(I’m doing something similar but can’t get IntelliJ to recognize my symbols)
e
Completion for which part? I haven't paid attention to it in a while, but everything used to work as expected.
m
The symbols in
build/generated/ksp/metadata/commonMain/
. They’re somehow all red for me
e
m
I have it too here but somehow not working, maybe there’s an order issue or something. I’ll try again with KSP2
e
Maybe it's something to do with the difference between lazy (
named(...).configure
) vs eager (
findByName
). I think someone once told me there's no difference between those for source sets, but you never know.
nod 1
👍 1
f
@mbonnin my original issue was that I only had JVM
👍 1
a
Hello there 👋 I have the same problem: having
kspCommonMainMetadata
task in my project, but no target is triggering it (neither android, nor iOS ...). Do we need to ask to special setup then?
You’ll need to set the dependency manually:
Copy code
project.tasks.withType(KotlinCompilationTask::class.java).configureEach {
    if(name != "kspCommonMainKotlinMetadata") {
      dependsOn("kspCommonMainKotlinMetadata")
    }
  }
a
arf ok. Need to be part of the documentation to help people setup my lib 👍
Thanks @mbonnin wasn't sure if it was that
👍 1
m
@arnaud.giuliani another option is to ship a Gradle plugin that does the wiring automagically, saves a bit of boilerplate to your users
323 Views