Output folder of the Kotlin compiler in Eclipse

后端 未结 2 1141
暖寄归人
暖寄归人 2021-02-15 00:59

The Jetbrains Kotlin compiler in Eclipse outputs to a hidden folder inside the Eclipse compiler plugin. This hidden folder is then made available through the Eclipse Kotlin clas

相关标签:
2条回答
  • 2021-02-15 01:31

    Currently, this is not possible in the Kotlin Eclipse plugin.

    To make it possible that Kotlin code can be used from Java, Kotlin plugin produce so-called lightweight class files to this folder. These class files do not contain bodies for methods and they are stored in memory.

    Actual class files, that are used to run an application, are being built only before launch and they are produced to the default output folder. For now, we cannot produce class files on each save reasonably fast as there is no incremental compilation in the plugin yet: Feel free to upvote for this issue.

    0 讨论(0)
  • 2021-02-15 01:31

    From the short analysis of the code of Kotlin plugin, it looks like the proper method is KotlinCompiler.compileKotlinFiles. It is being called in two contexts:

    1. KotlinBuilder.build — this is the one called on the project build; it makes a call stack trick (or rather a hack...) to check if being called from the LaunchConfigurationDelegate, and depending on the results, either compiles whole project (via its own private fun compileKotlinFiles), or just makes stubs in memory.
    2. KotlinCompilerUtils.compileWholeProject — this is in fact being called from 1.; nice static method, perfect for abuse until the problem is correctly solved in the plugin. :)

    So, I'd use the method from 2. wrapped in a similar way as compileKotlinFiles from file in 1.

    0 讨论(0)
提交回复
热议问题