Skip to content

Commit bcf2181

Browse files
Merge pull request #44 from coding-blocks/kotlin_worker
kotlin worker initiated
2 parents d71693e + 2f5cdfa commit bcf2181

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

containers/kotlin/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM codingblocks/judge-worker-base
2+
3+
RUN apk add --no-cache openjdk8 bash
4+
ENV PATH="/usr/lib/jvm/java-1.8-openjdk/bin:${PATH}"
5+
6+
RUN apk add --no-cache bash && \
7+
apk add --no-cache -t build-dependencies wget && \
8+
cd /usr/lib && \
9+
wget https://github.com/JetBrains/kotlin/releases/download/v1.2.70-eap-4/kotlin-compiler-1.2.70-eap-4.zip && \
10+
unzip kotlin-compiler-*.zip && \
11+
rm kotlin-compiler-*.zip && \
12+
rm kotlinc/bin/*.bat && \
13+
apk del --no-cache build-dependencies
14+
ENV PATH $PATH:/usr/lib/kotlinc/bin
15+
16+
COPY ./compile.sh /bin/compile.sh
17+
COPY ./run.sh /bin/run.sh
18+
19+
RUN chmod 777 /bin/compile.sh; \
20+
chmod 777 /bin/run.sh

containers/kotlin/compile.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
kotlinc Main.kt

containers/kotlin/run.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
java Main

test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,7 @@
5151
@test "test rust" {
5252
bash tests/test_workers.sh rust
5353
}
54+
55+
@test "test kotlin" {
56+
bash tests/test_workers.sh kotlin
57+
}

tests/kotlin/Main.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fun main(args: Array<String>) {
2+
val enterValue = readLine()
3+
println("Hello $enterValue")
4+
}

tests/kotlin/run.stdin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
World

0 commit comments

Comments
 (0)