diff --git a/api/Dockerfile b/api/Dockerfile index 72eb257..40ecb71 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -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 rename && \ + libncurses6 libncurses5 libedit-dev libseccomp-dev && \ rm -rf /var/lib/apt/lists/* RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen diff --git a/api/src/executor/job.js b/api/src/executor/job.js index f7adec2..c0cd1a6 100644 --- a/api/src/executor/job.js +++ b/api/src/executor/job.js @@ -21,7 +21,7 @@ class Job { this.uuid = uuidv4(); this.runtime = runtime; this.files = files.map((file,i) => ({ - name: file.name || `file${i}.code`, + name: file.name || `file${i}`, content: file.content })); diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile index 8bfcc27..1500acb 100644 --- a/packages/dotnet/5.0.201/compile +++ b/packages/dotnet/5.0.201/compile @@ -3,13 +3,10 @@ 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 \ No newline at end of file diff --git a/packages/gcc/10.2.0/compile b/packages/gcc/10.2.0/compile index 8ef8ec5..acc9ae4 100644 --- a/packages/gcc/10.2.0/compile +++ b/packages/gcc/10.2.0/compile @@ -5,16 +5,16 @@ case "${PISTON_ALIAS}" in gcc | c) - rename 's/$/\.c/' "$@" # Add .c extension - gcc -std=c11 *.c -lm + gcc -std=c11 "$@" -lm ;; g++ | c++ | cpp) - rename 's/$/\.cpp/' "$@" # Add .cpp extension - g++ -std=c++17 *.cpp + g++ -std=c++17 "$@" + ;; + gccgo | go) + gccgo "$@" ;; gdc | d) - rename 's/$/\.d/' "$@" # Add .d extension - gdc *.d + gdc "$@" ;; *) echo "How did you get here? (${PISTON_ALIAS})" diff --git a/packages/haskell/9.0.1/compile b/packages/haskell/9.0.1/compile index 18e268b..2dd42e9 100644 --- a/packages/haskell/9.0.1/compile +++ b/packages/haskell/9.0.1/compile @@ -1,6 +1,5 @@ #!/usr/bin/env bash # Compile haskell file(s) -rename 's/$/\.hs/' "$@" # Add .hs extension -ghc -dynamic -v0 -o out *.hs +ghc -dynamic -v0 -o out "$@" chmod +x out diff --git a/packages/java/15.0.2/run b/packages/java/15.0.2/run index 505e4e4..0837ba4 100644 --- a/packages/java/15.0.2/run +++ b/packages/java/15.0.2/run @@ -1,7 +1,4 @@ #!/usr/bin/env bash # Put instructions to run the runtime -mv $1 $1.java -filename=$1.java -shift -java $filename "$@" +java "$@" diff --git a/packages/kotlin/1.4.31/compile b/packages/kotlin/1.4.31/compile index 027ade0..d042c39 100644 --- a/packages/kotlin/1.4.31/compile +++ b/packages/kotlin/1.4.31/compile @@ -1,7 +1,4 @@ #!/usr/bin/env bash # Put instructions to compile source code, remove this file if the language does not require this stage - -rename 's/$/\.kt/' "$@" # Add .kt extension - -kotlinc *.kt -include-runtime -d code.jar \ No newline at end of file +kotlinc "$@" -include-runtime -d code.jar \ No newline at end of file diff --git a/packages/ocaml/4.12.0/compile b/packages/ocaml/4.12.0/compile index 39ddd0b..c1d3e6a 100644 --- a/packages/ocaml/4.12.0/compile +++ b/packages/ocaml/4.12.0/compile @@ -1,5 +1,3 @@ #!/bin/bash -rename 's/$/\.ml/' "$@" # Add .ml extension - -ocamlc -o out *.ml +ocamlc -o out "$@" diff --git a/packages/ponylang/0.39.0/compile b/packages/ponylang/0.39.0/compile index b0538df..a412613 100644 --- a/packages/ponylang/0.39.0/compile +++ b/packages/ponylang/0.39.0/compile @@ -1,5 +1,4 @@ #!/usr/bin/env bash # Compile pony file(s) -rename 's/$/\.pong/' "$@" # Add .pony extension ponyc -b out \ No newline at end of file diff --git a/packages/scala/3.0.0/run b/packages/scala/3.0.0/run index f8ff8a1..e8bd3c2 100644 --- a/packages/scala/3.0.0/run +++ b/packages/scala/3.0.0/run @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Put instructions to run the runtime -scala "$@" +scala -color never "$@" diff --git a/packages/test.sh b/packages/test.sh deleted file mode 100755 index 9f30237..0000000 --- a/packages/test.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/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 diff --git a/packages/typescript/4.2.3/compile b/packages/typescript/4.2.3/compile index d674bb0..fdf5f19 100644 --- a/packages/typescript/4.2.3/compile +++ b/packages/typescript/4.2.3/compile @@ -2,6 +2,4 @@ # Put instructions to compile source code, remove this file if the language does not require this stage -rename 's/$/\.ts/' "$@" # Add .ts extension - -tsc *.ts \ No newline at end of file +tsc "$@" \ No newline at end of file diff --git a/packages/vlang/0.1.13/run b/packages/vlang/0.1.13/run index 18b6c05..d8fa7b2 100644 --- a/packages/vlang/0.1.13/run +++ b/packages/vlang/0.1.13/run @@ -5,9 +5,4 @@ export VMODULES="$PWD" export TMPDIR="$PWD" # Put instructions to run the runtime - -rename 's/$/\.v/' "$@" # Add .v extension - -filename=$1.v -shift -v run $filename "$@" \ No newline at end of file +v run "$@" \ No newline at end of file diff --git a/packages/zig/0.7.1/compile b/packages/zig/0.7.1/compile index b666371..af7e9eb 100644 --- a/packages/zig/0.7.1/compile +++ b/packages/zig/0.7.1/compile @@ -1,6 +1,4 @@ #!/usr/bin/env bash # optimizing for small programs -rename 's/$/\.zig/' "$@" # Add .zig extension - -zig build-exe -O ReleaseSmall --color off --cache-dir . --global-cache-dir . --name out *.zig +zig build-exe -O ReleaseSmall --color off --cache-dir . --global-cache-dir . --name out "$@"