Skip to content
Permalink
Browse files

Jotlin 1.0!!

  • Loading branch information
jrtapsell committed Apr 3, 2018
1 parent 7f9510d commit b2ca392e8fd727d0b02356d0a849b9efd4d1867e
Showing with 1,058 additions and 177 deletions.
  1. +1 −7 Dockerfile
  2. +29 −2 build.gradle
  3. +8 −0 examples/120925/data.json
  4. +1 −0 examples/120925/header.jt
  5. +1 −18 examples/120925/input.jt
  6. +8 −0 examples/120925/metadata.json
  7. 0 examples/120925/output.txt
  8. +6 −0 examples/142243/data.json
  9. +1 −0 examples/142243/header.jt
  10. +0 −6 examples/142243/input.jt
  11. +8 −0 examples/142243/metadata.json
  12. +0 −4 examples/142243/output.txt
  13. +269 −0 examples/142331/data.json
  14. +1 −0 examples/142331/header.jt
  15. +1 −0 examples/142331/input.jt
  16. +8 −0 examples/142331/metadata.json
  17. +11 −0 examples/156967/data.json
  18. +1 −0 examples/156967/header.jt
  19. +1 −27 examples/156967/input.jt
  20. +8 −0 examples/156967/metadata.json
  21. 0 examples/156967/output.txt
  22. +1 −1 examples/160646/input.jt
  23. +5 −0 examples/160646/metadata.json
  24. +1 −0 examples/160646/output.txt
  25. +12 −0 examples/160857/data.json
  26. +1 −0 examples/160857/header.jt
  27. +1 −26 examples/160857/input.jt
  28. +8 −0 examples/160857/metadata.json
  29. +5 −0 examples/86075/metadata.json
  30. +287 −0 src/main/java/X.kt
  31. +14 −0 src/main/kotlin/jotlin/lang/Aliases.kt
  32. +2 −0 src/main/kotlin/jotlin/lang/AnyUtils.kt
  33. +2 −0 src/main/kotlin/jotlin/lang/IOUtils.kt
  34. +50 −14 src/main/kotlin/jotlin/lang/IterUtils.kt
  35. +3 −1 src/main/kotlin/jotlin/lang/LiteralUtils.kt
  36. +4 −22 src/main/kotlin/jotlin/lang/StringUtils.kt
  37. +6 −0 src/main/kotlin/jotlin/lang/utils/Logic.kt
  38. +2 −0 src/main/kotlin/jotlin/lang/utils/ScopedBlock.kt
  39. +4 −16 src/main/kotlin/jotlin/runner/EntryPoint.kt
  40. +22 −0 src/main/kotlin/jotlin/runner/Execute.kt
  41. +18 −0 src/main/kotlin/jotlin/runner/Help.kt
  42. +104 −0 src/main/kotlin/jotlin/runner/JotlinWrapper.kt
  43. +13 −0 src/main/kotlin/jotlin/runner/Mode.kt
  44. +21 −3 src/main/kotlin/jotlin/runner/Post.kt
  45. +67 −15 src/main/kotlin/jotlin/runner/Run.kt
  46. +5 −0 src/main/kotlin/jotlin/runner/TestUtils.kt
  47. +23 −1 src/main/kotlin/jotlin/runner/Utils.kt
  48. +11 −11 src/test/kotlin/jotlin/lang/IterUtilsTest.kt
  49. +1 −1 src/test/kotlin/jotlin/lang/LiteralUtilsTest.kt
  50. +2 −2 src/test/kotlin/jotlin/lang/StringUtilsTest.kt
@@ -9,10 +9,4 @@ FROM openjdk
WORKDIR /app

COPY --from=0 /home/gradle/build/libs/* app.jar
COPY runner/* ./
RUN chmod +x run.sh
RUN apt-get update && apt-get install zip
RUN curl -s "https://get.sdkman.io" | bash
RUN ["/bin/bash", "-c", "source /root/.sdkman/bin/sdkman-init.sh;sdk install kotlin"]

ENTRYPOINT ["/app/run.sh"]
ENTRYPOINT ["java", "/app/app.jar"]
@@ -12,11 +12,12 @@ buildscript {
plugins {
id "com.github.johnrengelman.shadow" version "2.0.3"
id 'com.github.kt3k.coveralls' version '2.6.3'
id 'net.saliman.cobertura' version '2.5.4'
}
apply plugin: "jacoco"

group "uk.co.jrtapsell"
version "1.0-SNAPSHOT"
version "1.0"

apply plugin: 'java'
apply plugin: 'kotlin'
@@ -37,8 +38,29 @@ dependencies {
compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-util', version: kotlin_version
testCompile group: 'org.testng', name: 'testng', version: '6.13.1'
compile group: 'org.jetbrains.kotlin', name: 'kotlin-jsr223-local-example', version: '1.1-M04-eap-14'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+"
}

// https://gist.github.com/JonasGroeger/7620911
def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
/*
* '.git/HEAD' contains either
* in case of detached head: the currently checked out commit hash
* otherwise: a reference to a file containing the current commit hash
*/
def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd
// def isRef = head.length > 1 // ref: refs/heads/master

if (isCommit) return head[0].trim() // e5a7c79edabb

def refHead = new File(gitFolder + head[1].trim()) // .git/refs/heads/master
refHead.text.trim()
}


compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
@@ -55,7 +77,8 @@ jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version,
'Main-Class': 'jotlin.runner.EntryPoint'
'Main-Class': 'jotlin.runner.EntryPoint',
'Specification-Version': getCheckedOutGitCommitHash()
}
}

@@ -68,4 +91,8 @@ jacocoTestReport {

coveralls {
sourceDirs = ['src/main/kotlin']
}

cobertura {
coverageSourceDirs = ['src/main/kotlin']
}
@@ -0,0 +1,8 @@
[
{"in":["hi.txt"], "out":"txt"},
{"in":["carrot.meme"], "out":"meme"},
{"in":["what..is..this..file"], "out":"file"},
{"in":[".bashrc"], "out":"bashrc"},
{"in":["T00M@n3KaPZ.h0wC[]h"], "out":"h0wC[]h"},
{"in":["agent.000"], "out":"000"}
]
@@ -0,0 +1 @@
fun String.f() =
@@ -1,18 +1 @@
data class Test(val input: String, val output: String)

val test = listOf(
Test("hi.txt", "txt"),
Test("carrot.meme", "meme"),
Test("what..is..this..file", "file"),
Test(".bashrc", "bashrc"),
Test("T00M@n3KaPZ.h0wC[]h", "h0wC[]h"),
Test("agent.000", "000")
)

fun String.f() = split(".").last()

for ((i, o) in test) {
if (o != i.f()) {
throw AssertionError()
}
}
split(".").last()
@@ -0,0 +1,8 @@
{
"type": "battery",
"header": "header.jt",
"body": "input.jt",
"data": "data.json",
"testFunction": "r.input0.f()",
"types": {"in": ["String"], "out": "String"}
}
No changes.
@@ -0,0 +1,6 @@
[
{"in":[12], "out":"F"},
{"in":[15], "out":"E"},
{"in":[301], "out":"A"},
{"in":[181], "out":"C"}
]
@@ -0,0 +1 @@
var x:(Int)->Char =
@@ -1,7 +1 @@
var x:(Int)->Char =
{v->'F'-l(13,170,180,294,300).f{b<v}.l()}

println(x(12))
println(x(15))
println(x(301))
println(x(181))
@@ -0,0 +1,8 @@
{
"type": "battery",
"header": "header.jt",
"body": "input.jt",
"data": "data.json",
"testFunction": "x(r.input0)",
"types": {"in": ["Int"], "out": "Char"}
}

This file was deleted.

0 comments on commit b2ca392

Please sign in to comment.
You can’t perform that action at this time.