https://kotlinlang.org logo
Title
j

Jiaxiang

03/11/2021, 12:51 AM
Hi, here is our biweekly release for KSP: https://github.com/google/ksp/releases/tag/1.4.30-1.0.0-alpha05 Highlights • synthetic property accessors now can be correctly created for abstract classes, align with compiler behavior. • Removed 
findAnnotationFromUseSiteTarget()
 function, consolidate its functionality into KSP internal logic. Behavior change • KSP now handles annotation use site targets internally for property accessors (namely 
@get:Anno
@set:Anno
). ◦ property accessors will have corresponding targeted annotations from their receiver properties ◦ annotations with 
@get:
 and 
@set:
 targets will not appear in property’s annotation list.
🎉 6
j

Javier

03/11/2021, 12:59 AM
I don't remember if Kotlin 1.5 solves the problem which stops ksp moving to Multiplatform. Do you know that?
j

Jiaxiang

03/11/2021, 1:12 AM
which problem are you referring to?
j

Javier

03/11/2021, 1:26 AM
ksp can't be Multiplatform because it is limited by a problem related to the Kotlin compiler plugin no?
t

Ting-Yuan Huang

03/11/2021, 8:52 AM
multiplatform for jvm (
kotlin("multiplatform")
+
kotlin { jvm() }
) will be usable in next bi-weekly release. JS and Kotlin native require some changes in upstream compiler that we are currently working on. They won't be available in Kotlin 1.5.0 since it already branched.
👍 1
j

Javier

03/11/2021, 11:49 AM
Thank you :)
m

Miguel Vera Belmonte

03/11/2021, 9:29 PM
Hi @Ting-Yuan Huang, could you elaborate on which changes are necessary on the compiler side for Kotlin/JS to work? because I tried implementing KSP on a K/JS project back when multiplatform was working (before https://github.com/google/ksp/issues/317), and I got it working more or less, the only thing is that the
kspKotlinJs
task generated the sources in the same folder as the
kspKotlinJvm
task, and thus JVM and JS sources were being compiled in the same sourceset, but that could be relatively easily fixed by changing the folder depending on the target platform in KSP, right? Is that it or is there another issue with the Kotlin compiler altogether? Just asking so that I can get a grasp of the inner workings of the library and the compiler 😁
t

Ting-Yuan Huang

03/11/2021, 10:11 PM
Currently ksp invokes the jvm compiler frontend only when the target is jvm. For other targets, it needs to invoke the corresponding frontends because of platform specific things, such as resolving to correct dependencies / libraries. The missing part is the extension point (
AnalysisHandlerExtension
) for KSP to hook on. For pure Kotlin sources that only uses the common set of Kotlin features, it might be possible to use kotlin/jvm to generate for other platforms by manipulating source sets carefully. I haven't tried that way but I guess it could be tricky.
👍 2
m

Miguel Vera Belmonte

03/12/2021, 9:28 AM
I understand, thanks for the response