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 support #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions containers/kotlin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM zenika/alpine-kotlin:1.2

COPY ./compile.sh /bin/compile.sh
COPY ./run.sh /bin/run.sh

RUN chmod 777 /bin/compile.sh; \
chmod 777 /bin/run.sh
3 changes: 3 additions & 0 deletions containers/kotlin/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

kotlinc Main.kt 2> compile.stderr 1> compile.stdout
3 changes: 3 additions & 0 deletions containers/kotlin/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

kotlin MainKt < run.stdin 1> run.stdout 2> run.stderr
4 changes: 4 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@
sh tests/py3/test_worker.sh
}

@test "test kotlin" {
bash tests/kotlin/test_worker.sh
}

4 changes: 4 additions & 0 deletions tests/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

fun main(args: Array<String>) {
println("Hello")
}
1 change: 1 addition & 0 deletions tests/kotlin/run.stdin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
World
26 changes: 26 additions & 0 deletions tests/kotlin/test_worker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
pushd $(dirname "$0")
DIR=$(pwd)
RUNBOX="${DIR}/runbox"

echo $RUNBOX
# Create runbox
mkdir -p $RUNBOX

# Copy source to runbox
cp $DIR/Main.java $RUNBOX/Main.kt
cp $DIR/run.stdin $RUNBOX/run.stdin

# Test Compile
docker run \
--cpus="1" \
--memory="100m" \
--ulimit nofile=64:64 \
--rm \
--read-only \
-v "$RUNBOX":/usr/src/runbox \
-w /usr/src/runbox codingblocks/judge-worker-kotlin \
bash -c "/bin/compile.sh && /bin/run.sh"

# Delete runbox
rm -rf $RUNBOX