Compare commits

...

14 Commits

Author SHA1 Message Date
Thomas Hobson 03c64cfecf
ponylang extension 2021-04-24 20:10:07 +12:00
Thomas Hobson 5e9b9c888e
ocaml extension 2021-04-24 20:09:59 +12:00
Thomas Hobson a1209cdfd5
kotlin extension 2021-04-24 20:09:51 +12:00
Thomas Hobson d2c36d8a54
java extension 2021-04-24 20:09:39 +12:00
Thomas Hobson af91e66d64
haskell extension 2021-04-24 20:09:33 +12:00
Thomas Hobson ceb902349f
scala extension 2021-04-24 20:09:25 +12:00
Thomas Hobson 8923fbd5cf
typescript extension 2021-04-24 20:09:17 +12:00
Thomas Hobson ecfdfa52de
vlang extension 2021-04-24 20:08:48 +12:00
Thomas Hobson 594ee7d436
zig extension 2021-04-24 20:08:42 +12:00
Thomas Hobson d851515f37
api: install rename in container 2021-04-24 19:51:33 +12:00
Thomas Hobson dfdf8ce76e
gcc add extensions 2021-04-24 19:46:36 +12:00
Thomas Hobson f72c51d614
dotnet add cs extension 2021-04-24 19:44:50 +12:00
Thomas Hobson c6e78fa073
test script 2021-04-24 19:35:14 +12:00
Thomas aeda95a215
add .code extension to files without file names 2021-04-24 17:59:06 +12:00
14 changed files with 58 additions and 16 deletions

View File

@ -10,7 +10,7 @@ RUN for i in $(seq 1001 1500); do \
RUN apt-get update && \
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev \
binutils build-essential locales libpcre3-dev libevent-dev libgmp3-dev \
libncurses6 libncurses5 libedit-dev libseccomp-dev && \
libncurses6 libncurses5 libedit-dev libseccomp-dev rename && \
rm -rf /var/lib/apt/lists/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen

View File

@ -21,7 +21,7 @@ class Job {
this.uuid = uuidv4();
this.runtime = runtime;
this.files = files.map((file,i) => ({
name: file.name || `file${i}`,
name: file.name || `file${i}.code`,
content: file.content
}));

View File

@ -3,10 +3,13 @@
export DOTNET_CLI_HOME=$PWD
export HOME=$PWD
rename 's/$/\.cs/' "$@" # Add .cs extension
dotnet build --help > /dev/null # Shut the thing up
dotnet new console -o . --no-restore
rm Program.cs
dotnet restore --source $DOTNET_ROOT/.nuget/packages
dotnet build --no-restore

View File

@ -5,16 +5,16 @@
case "${PISTON_ALIAS}" in
gcc | c)
gcc -std=c11 "$@" -lm
rename 's/$/\.c/' "$@" # Add .c extension
gcc -std=c11 *.c -lm
;;
g++ | c++ | cpp)
g++ -std=c++17 "$@"
;;
gccgo | go)
gccgo "$@"
rename 's/$/\.cpp/' "$@" # Add .cpp extension
g++ -std=c++17 *.cpp
;;
gdc | d)
gdc "$@"
rename 's/$/\.d/' "$@" # Add .d extension
gdc *.d
;;
*)
echo "How did you get here? (${PISTON_ALIAS})"

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash
# Compile haskell file(s)
ghc -dynamic -v0 -o out "$@"
rename 's/$/\.hs/' "$@" # Add .hs extension
ghc -dynamic -v0 -o out *.hs
chmod +x out

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
java "$@"
mv $1 $1.java
filename=$1.java
shift
java $filename "$@"

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash
# Put instructions to compile source code, remove this file if the language does not require this stage
kotlinc "$@" -include-runtime -d code.jar
rename 's/$/\.kt/' "$@" # Add .kt extension
kotlinc *.kt -include-runtime -d code.jar

View File

@ -1,3 +1,5 @@
#!/bin/bash
ocamlc -o out "$@"
rename 's/$/\.ml/' "$@" # Add .ml extension
ocamlc -o out *.ml

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
# Compile pony file(s)
rename 's/$/\.pong/' "$@" # Add .pony extension
ponyc -b out

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash
# Put instructions to run the runtime
scala -color never "$@"
scala "$@"

20
packages/test.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
AUTH_HEADER="Authorization: $API_KEY"
for test_file in */*/test.*
do
IFS='/' read -ra test_parts <<< "$test_file"
language=${test_parts[0]}
lang_ver=${test_parts[1]}
test_src=$(python3 -c "import json; print(json.dumps(open('$test_file').read()))")
json='{"language":"'$language'","version":"'$lang_ver'","files":[{"content":'$test_src'}]}'
result=$(curl -s -XPOST -H "Content-Type: application/json" -d "$json" https://emkc.org/api/v2/piston/execute -H $AUTH_HEADER)
echo "==$test_file: $language-$lang_ver=="
#jq '.' <<<"$result"
jq -r '.compile.output + .run.output' <<<$result
done

View File

@ -2,4 +2,6 @@
# Put instructions to compile source code, remove this file if the language does not require this stage
tsc "$@"
rename 's/$/\.ts/' "$@" # Add .ts extension
tsc *.ts

View File

@ -5,4 +5,9 @@ export VMODULES="$PWD"
export TMPDIR="$PWD"
# Put instructions to run the runtime
v run "$@"
rename 's/$/\.v/' "$@" # Add .v extension
filename=$1.v
shift
v run $filename "$@"

View File

@ -1,4 +1,6 @@
#!/usr/bin/env bash
# optimizing for small programs
zig build-exe -O ReleaseSmall --color off --cache-dir . --global-cache-dir . --name out "$@"
rename 's/$/\.zig/' "$@" # Add .zig extension
zig build-exe -O ReleaseSmall --color off --cache-dir . --global-cache-dir . --name out *.zig