Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin starter package #317

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

vafin-mk
Copy link

@vafin-mk vafin-mk commented Dec 9, 2016

Added kotlin language package. Kotlin compiler can be installed from https://github.com/JetBrains/kotlin/releases/latest

@truell20
Copy link
Contributor

truell20 commented Dec 11, 2016

Would love to hear @nmalaguti thoughts on this implementation

@nmalaguti
Copy link
Contributor

It looks like a lot of this is from the Java -> Kotlin autoconversion. It doesn't use a lot of Kotlin idioms.

Example:

for (b in 0..width - 1) {
    row.add(Integer.parseInt(input[index]))
    index++
}

would be better as

for (b in 0 until width) {
    row.add(Integer.parseInt(input[index]))
    index++
}

// or you could do something like
input.take(width).map { Integer.parseInt(it) }

Also might want to use mutableListOf instead of creating explicit ArrayList instances.

@vafin-mk
Copy link
Author

Does it look better now?

@nmalaguti
Copy link
Contributor

Does it look better now?

Much!

I think the package should include details on how to create a JAR with the Kotlin runtime included and a Main-Class in the manifest (unless kotlinc does that automatically?)

It should also include a LANGUAGE file with Kotlin in it.

@truell20
Copy link
Contributor

I think the package should include details on how to create a JAR with the Kotlin runtime included and a Main-Class in the manifest (unless kotlinc does that automatically?)

It should also include a LANGUAGE file with Kotlin in it.

We can include a Kotlin compiler on the server and properly tag Kotlin bots with the name "Kotlin."

It is still nice to have the LANGUAGE file in case anyone wants to switch to building with a JAR.

@vafin-mk
Copy link
Author

Not sure what is LANGUAGE(just txt with "Kotlin" inside?) file and where it should be.

executable JAR file can be created with:

kotlinc *.kt -include-runtime -d *name*.jar
jar ufe **name**.jar *MainClassName*Kt

and simple run with: java -jar *name*.jar
Should i create sh/bat scripts for that?

@truell20
Copy link
Contributor

Not sure what is LANGUAGE(just txt with "Kotlin" inside?) file and where it should be.

Yes. See "Customizing your language name" in this doc.

Should i create sh/bat scripts for that?

That would be great.

@nmalaguti
Copy link
Contributor

The CI tests are failing because starter packs are assumed to be valid submissions with a MyBot.* file. In this case, the tests would be looking for a MyBot.jar file. Since users are expected to create their jar and zip it up, I'm not sure what to do about the assumption that all starter packs are valid submissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants