codewars / codewars-runner-cli

Old CodeRunner project. See https://github.com/codewars/runner instead.
GNU Affero General Public License v3.0
402 stars 141 forks source link

Add support for Kotlin #165

Closed Kavignon closed 7 years ago

Kavignon commented 8 years ago

Kotlin is this new language created by the JetBeans company. It's a statically typed language for Android development working on the JVM. The language is influency by many languages such as Java, Groovy and C#. It has a lot of potential and I think a language, open source might I've add (https://github.com/JetBrains/kotlin), will be a fine addition for Codewars.

javatlacati commented 7 years ago

does this helps https://hub.docker.com/r/yongjhih/kotlin/ ?

OverZealous commented 7 years ago

Just an FYI: we have partial support for Kotlin—you can run Kotlin code within a container, but it's not finished and is a bit slow to start up. Our JVM runner was built on top of Clojure, and it's hard to add new JVM languages to it directly.

What the Kotlin runner needs to become usable within Codewars is integration of a test framework.

I was specifically looking at Spek, since it's built on top of JUnit already, and officially supported by JetBrains. I just haven't had the time to dig into it more recently.

javatlacati commented 7 years ago

I can't see other people Kumites for it si I tought you had no docke Image for it I apologize. 😢 that's the one I created: https://www.codewars.com/kumite/581247062542c0849c00000e?sel=581247062542c0849c00000e

Perhaps you should stop using leningen to run Java (since at least at codewars it seems to be ignoring some features like final keyword) and start with a real Java docker image that runs and compiles classes by reflection or similar mechanisms. I think that since you can run Kotlin classes from Java code you should be able to run fixtures with simple plain JUnit and it's possible runners (MockitoJunitRunner included of course).

OverZealous commented 7 years ago

I agree, we just don't have the resources for a complete rewrite of the runner at this moment. Though I don't understand what you mean by "a real Java docker image"—all of our images are built on top of our base image, we're not just using random Docker images. There's more to a Codewars image than just simply running code.

At any rate, it's on our radar to improve the JVM runner across the board, which should make it easier for us to expand our JVM support (including Kotlin & Groovy).

ice1000 commented 7 years ago

Typo: JetBrains(not JetBeans

ice1000 commented 7 years ago

I tried to kumite using Kotlin but I get error while running my code.

I just simply created an extension method and didn't output anything. I couldn't submit due to the strange error.

javatlacati commented 7 years ago

PErhaps with the new jVM runner this can help: https://kotlinlang.org/docs/reference/using-gradle.html

ice1000 commented 7 years ago

Yeah, since we have gradle, we can add Kotlin plugin and compile/test with gradle. It's very easy, just add the plugin to the config file. Gradle supports JUnit, so we can use JUnit or Spek, or both of them at the same time.

I'll see if I can help with it later

autonomousapps commented 7 years ago

I'm just an outside observer (user), but I rather like the Kluent library for writing fluent assertions with JUnit style tests. Kluent is built on mockito.

kazk commented 7 years ago

@ice1000 Just wanted to let you know that I started to look into this. Building Kotlin with Gradle is easy, but it gets complicated when integrating that with this codebase. I might ask for your review once I open a PR, any feedback will be appreciated.

ice1000 commented 7 years ago

It's my honor. Cheers

kazk commented 7 years ago

@ice1000 I opened PR #487. Please let us know what you think :)

ice1000 commented 7 years ago

Excited!

javatlacati commented 7 years ago

When can we see it running???