Hi Amper team, how are you planning to support com...
# amper
s
Hi Amper team, how are you planning to support compiler plugins (including third-party) in Amper? Most of these plugins come with an accompanying Gradle plugin. Are there any plans to support third-party compiler plugins (such as Kopy, redacted) in the next release?
j
For now, we only support the "built-in" Kotlin compiler plugins. That said, it is definitely possible to add support for arbitrary compiler plugins in Amper (with maven coordinates) if the need comes up. We had not seen much demand for this so far. Thanks for the examples. Do these examples require IDE support? Because for 3rd parties, it usually means a 3rd party IDE plugin is needed as well.
g
Also custom plugins
j
Ah I see that the IDE support requires some shenanigans: https://zacsweers.github.io/metro/installation.html#ide-support
On Amper side, it might as simple as supporting something like this:
Copy code
settings:
  kotlin:
    compilerPlugins:
      - id: dev.zacsweers.metro.compiler
        dependency: dev.zacsweers.metro:metro-compiler-plugin:0.5.5
        options:
          someKey: someValue
(similar to KSP support) But this needs special handling if we want the IDE to understand the plugin. At the moment, the Kotlin IDE plugin provides support for a select number of plugins, and we would need to figure out a way for 3rd party IDE plugins to register the support for some Kotlin compiler plugins. At the moment there is no generic way to do this that is build-system-agnostic.
Also the options would be untyped, so most likely the compiler plugin authors would write an Amper plugin to wrap this configuration (like they do for Gradle). So we first want to provide some extensibility prototype (coming soon)
z
Yah I would only use metro's IDE support if you're feeling adventurous. Have some ideas on making it more usable in the future but it's lower priority at the moment
s
add support for arbitrary compiler plugins in Amper (with maven coordinates) if the need comes up
Without that, we can’t use any third-party compiler plugins on Amper. I’m already using three (redacted, kopy, mokkery), so IMHO, this should be a supported feature out of the box.
Do these examples require IDE support?
Yes, kopy also need to configure some internal registry option - https://github.com/JavierSegoviaCordoba/kopy?tab=readme-ov-file#allow-third-party-k2-plugins