Seeking for help: support Kotlin in ActFramework


#1

I like the Kotlin as an new JVM language, it’s simple, elegant and expressive. I really want to support Kotlin in my new MVC fullstack framework: ActFramework.

One important feature of ActFramework is hot-reloading at dev mode. I rely on ecj to compile source code in memory to support it.

I am looking for a way to add support to kt source and I need:

  • An API to call compiler to compile a list of source code in memory (not from build tool, e.g. maven/gradle etc)
  • An API to callback when compiling looking for a dependency type (like ecj’s INamedEnvironment)
  • (Optionally) Able to compile mixed Java source and kt source list

Any clue or help is appreciated!


#2

AFAIK, there is no such public API provided by Kotlin compiler at this moment.

If you’re curious, you can explore Kotlin-to-JVM compiler entry point here https://github.com/JetBrains/kotlin/blob/1.1.0/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/K2JVMCompiler.kt, but note that you’re doing it at your own risk.


#3

Thanks ilya. Is that K2JVMCompiler able to compile mixed Java/KT source files?