How to add compiler plugin with scripting

I am writing scripting host, but can’t find a api to add compiler plugin.

How to add one like kotlinx.serialization or kapt.
Is it able to config custom plugin using annotation like @file:DependsOn

First, you should define know what kind of plugin you need

  • You might need a gradle plugin to work with gradle (the easiest and most flexible)
  • You might need a kotlin compiler plugin to work with the compiler
  • You might need an annotation processor if you want to only work with annotations (it has some limitations)
  • You might need an IDE plugin if you want special syntax highlighting

Every one of these has its own manual and can be searched by its name.
But the thing is, you must first determine what you want to do and where
you want it to be done. (And if it is worth it or not)

I say compiler plugin or kotlin compiler plugin.

And my question is about kotlin scripting, I can’t find any doc about that.