google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.84k stars 265 forks source link

KSP compatibility with Kotlin/Native and Kotlin/JS #33

Open davidjwiner opened 4 years ago

davidjwiner commented 4 years ago

Tracking issue for multiplatform support in KSP.

raniejade commented 4 years ago

Out of curiosity, what is needed to support the native and js platforms?

ting-yuan commented 4 years ago

Currently, the compiler extension point only exists on JVM platform.

edrd-f commented 3 years ago

Hi. What's the state of JS IR support?

dhcoder commented 3 years ago

Seems like this has experimental support as of 1.5.20? https://github.com/google/ksp/releases/tag/1.5.20-1.0.0-beta03 Haven't tried it yet, will hopefully be chasing this down myself today

evant commented 3 years ago

@dhcoder That release had js support, but only for legacy, not IR. There were changes needed to the compiler for that https://github.com/JetBrains/kotlin/pull/4264. As those are merged now, not sure if we need to wait for a new release of kotlin, or an update in ksp, or both?

dhcoder commented 3 years ago

Ah gotcha. Thanks for the clarification. Definitely interested in IR support here as well.

On Thu, Sep 16, 2021, 10:24 AM Evan Tatarka @.***> wrote:

@dhcoder https://github.com/dhcoder That release had js support, but only for legacy, not IR. There were changes needed to the compiler for that JetBrains/kotlin#4264 https://github.com/JetBrains/kotlin/pull/4264. As those are merged now, not sure if we need to wait for a new release of kotlin, or an update in ksp, or both?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/ksp/issues/33#issuecomment-921090072, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOCEHSX6NO5DYWIO2X3XLDUCIR4HANCNFSM4RZ6X2XA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

neetopia commented 3 years ago

we will need to wait for a release of kotlin, then we can update on KSP side.

dhcoder commented 2 years ago

I saw that 1.6.0 is RC now and was curious -- will that contain the hooks necessary to allow KSP to support JS IR?

ting-yuan commented 2 years ago

Yes. We'll release KSP 1.6.0-RC-1.0.0 later today.

btw, there is a KSP 1.6.0-M1-1.0.0 available if you consider Kotlin 1.6.0-M1.

andrew-k-21-12 commented 2 years ago

When using the kotlin("js") plugin, including the id("com.google.devtools.ksp") plugin (of version 1.7.10-1.0.6) leads to the exception:

java.lang.IllegalStateException: You already registered Kotlin/JS target with another compiler: legacy

It's thrown on the following lines:

kotlin {
    js(IR) {
        binaries.executable()
        browser {}
    }
}

The only way to get rid from this exception (or at least the one could find 🙂) - is to switch to the LEGACY compiler in the lines above.

The issue can be easily fixed by migrating to the kotlin("multiplatform") plugin instead. It seems to be super minor thing, but anyway, it's a little bit strange to use Kotlin Multiplatform when your project is Kotlin/JS-only.

Can add full build.gradle.kts files if needed.

neetopia commented 2 years ago

@andrew-k-21-12 Seems like a bug, can you create an issue for this?

andrew-k-21-12 commented 2 years ago

@neetopia Sure, here it is - https://github.com/google/ksp/issues/1056. Will remove my reproduce repo when the issue will be closed.

ansman commented 1 month ago

This is supported now right?

bitspittle commented 1 month ago

Pretty sure @ansman is right and this issue can be closed. I've been using ksp + Kotlin/js for at least a year now.