Merge pull request #10 from aveliz1999/kotlin-support

Add Kotlin support
This commit is contained in:
Brian Seymour 2020-06-04 19:12:35 -05:00 committed by GitHub
commit b8e833f513
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 0 deletions

View File

@ -73,6 +73,7 @@ func Execute(res http.ResponseWriter, req *http.Request) {
"go",
"java",
"julia", "jl",
"kotlin",
"nasm", "asm",
"node", "javascript", "js",
"php",

View File

@ -66,6 +66,9 @@ case "$lang" in
"julia" | "jl")
bin=julia
;;
"kotlin")
bin=kotlin
;;
"nasm" | "asm")
bin=nasm
;;

4
lxc/executors/kotlin Executable file
View File

@ -0,0 +1,4 @@
cd /tmp/$2
cp code.code code.kt
timeout -s KILL 10 kotlinc code.kt -include-runtime -d code.jar
runuser runner$1 -c "cd /tmp/$2 ; cat args.args | xargs -d '\n' timeout -s KILL 3 java -jar code.jar"

View File

@ -24,6 +24,9 @@ echo '---'
echo 'julia'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "julia --version"
echo '---'
echo 'kotlin'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "kotlinc -version"
echo '---'
echo 'nasm'
lxc-attach --clear-env -n piston -- /bin/bash -l -c "nasm -version"
echo '---'

View File

@ -145,6 +145,14 @@ tar -xzf julia-1.4.1-linux-x86_64.tar.gz
echo 'export PATH=$PATH:/opt/julia/julia-1.4.1/bin' >> /opt/.profile
source /opt/.profile
#install kotlin
#final binary: /opt/kotlinc/bin/kotlinc
cd /opt
wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip
unzip kotlin-compiler-1.3.72.zip
rm kotlin-compiler-1.3.72.zip
echo 'export PATH=$PATH:/opt/kotlinc/bin' >> /opt/.profile
source /opt/.profile
# create runnable users and apply limits
for i in {1..150}; do

3
tests/test.kt Normal file
View File

@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("good")
}

View File

@ -12,6 +12,8 @@ echo 'testing go'
../lxc/execute go test.go
echo 'testing java'
../lxc/execute java test.java
echo 'testing kotlin'
../lxc/execute kotlin test.kt
echo 'testing asm'
../lxc/execute asm test.nasm
echo 'testing js'