Hi Amper team, is there a specific reason why I ca...
# amper
s
Hi Amper team, is there a specific reason why I can’t use ksp for platform-specific settings? I have a KSP processor that only makes sense for the JVM target (e.g., Google Auto Service). When I add it, it throws the following error
Copy code
00:03.982 ERROR                           /../common.module-template.yaml:71:7: This setting can only be used without any @platform qualifier.
00:03.998 ERROR                           ..common.module-template.yaml:71:7: This setting can only be used without any @platform qualifier.
Copy code
settings@jvm:
  kotlin:
    ksp:
      version: 2.2.20-RC-2.0.2
      processors:
        - $libs.ksp.auto.service
a
I'm not very proficient in Amper ksp support (or ksp itself), but it feels to me that it makes no sense to apply processor to only one specific target, because then you are going to end up in the situation when common fragments to be compiled against different surrounding code generated for different platforms, which feels strange to me since the code in these common fragments take part in different compilations (according to KGP terminology) it may lead to even more different results for different platforms and also, ksp itself itsn't nessesary all platforms/tagets aware, but for it to work correctly it needs to know what is common source root and what isn't, which also implies that ksp processors must be KMP-aware at least if you write a library, I would suggest then to try to apply this processor globally (to the module) and hope it will figure it out how to work with jvm-only code or to extract jvm-only part in a separate module, and provide very limited API surface @joffrey has more context, so I would also wait for him to answer
s
apply this processor globally (to the module) and hope it will figure it out how to work with jvm-only
Yeah, this is working fine. Thanks for the details.
j
@suresh Note that this error is only about the
settings.kotlin.ksp.version
property (because we don't support using different versions of KSP for different platforms). You should be able to apply your processor only for
@jvm
like this:
Copy code
settings:
  kotlin:
    ksp:
      version: 2.2.20-RC-2.0.2
settings@jvm:
  kotlin:
    ksp:
      processors:
        - $libs.ksp.auto.service
🙏 1
👍 1