Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Tycho and Kotlin


On Tue, May 23, 2017 at 2:52 AM, Craig Otis <craigotis@xxxxxxxxx> wrote:
I'm researching the potential benefits/pitfalls of moving some of our codebase, which is based heavily on Eclipse RCP and thus also OSGi, from Java to Kotlin.

I think the main pitfall (general to the adoption of whatever other language on top of the JVM in any environment, not only RCP/OSGi) is that all this Kotlin code would only be reusable in Kotlin apps, and not in Java apps that easily, or at least not without brinding to the JVM the necessary Kotlin runtime classes. I don't know how well does Kotlin work in all Java environments (OSGi/RCP, Java 9, JBoss Modules, Maven...), but if it's not yet universally supported in any Java application, adopting it can become an issue. So you're basically adding one layer of indirection, one layer of dependencies, one layer of build, one layer of potential issues... Maybe it's worth it in your case, but moving existing code from a language to another is usually hard to be profitable.
Writing only new code in Kotlin (or whichever other JVM friendly language) maybe a safest path if you really want to jump in the Kotlin boat.
We're currently using the Tycho OSGi Compiler Plugin through Maven to assist in dependency management (with our own custom target platform), and project compilation. We're able to swap out the [tycho-compiler-plugin] for a combination of the [kotlin-maven-plugin] and the standard [maven-compiler-plugin], which works as expected for one of our projects that has no OSGi dependencies.
However - for our projects whose dependencies are MANIFEST-based and rely on Tycho/OSGi for dependency resolution/target platform computation, I'm wondering if we've hit a roadblock - as Kotlin needs to compile the Java bytecode prior to the other (Tycho/Maven) compilers kicking in, but if any of those Kotlin classes depend on the OSGi dependencies, our concern is that it won't be able to resolve them - so it's a bit of a chicken/egg problem.
Are there any guides/plans for supporting a Tycho + Kotlin build configuration, or tips to point us in the right direction?

You can look at how the Kotlin-Eclipse plugin is implemented: and . Seems like they simply bind the compile step of the kotlin-maven-plugin to the "process-sources" phase and do some AspectJ stuff.

Mickael Istria
Eclipse IDE developer, at Red Hat Developers community

Back to the top