Skip to content

Commit d37110b

Browse files
Extra. Add support for C#, F# and VB with .NET Core SDK and Mono.
1 parent 9f510d6 commit d37110b

File tree

11 files changed

+77
-5
lines changed

11 files changed

+77
-5
lines changed

extra/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,31 @@ RUN set -xe && \
7575
apt-get install -y --no-install-recommends clang clang-tidy clang-format && \
7676
rm -rf /var/lib/apt/lists/*
7777

78+
# .Net Core SDK
79+
ENV DOTNET_CLI_TELEMETRY_OPTOUT true
80+
RUN set -xe && \
81+
apt-get update -o Acquire::Check-Valid-Until=false && \
82+
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
83+
dpkg -i packages-microsoft-prod.deb && \
84+
rm packages-microsoft-prod.deb && \
85+
apt-get update -o Acquire::Check-Valid-Until=false && \
86+
apt-get install -y apt-transport-https && \
87+
apt-get update -o Acquire::Check-Valid-Until=false && \
88+
apt-get install -y dotnet-sdk-3.1 && \
89+
rm -rf /var/lib/apt/lists/*
90+
91+
# Mono
92+
RUN set -xe && \
93+
apt-get update -o Acquire::Check-Valid-Until=false && \
94+
apt-get install -y apt-transport-https dirmngr gnupg ca-certificates && \
95+
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
96+
echo "deb https://download.mono-project.com/repo/debian stable-buster main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \
97+
apt-get update -o Acquire::Check-Valid-Until=false && \
98+
apt-get install -y mono-complete mono-vbnc && \
99+
rm -rf /var/lib/apt/lists/*
100+
101+
COPY init-files /init-files
102+
78103
COPY cron /etc/cron.d
79104
RUN set -xe && \
80105
apt-get update -o Acquire::Check-Valid-Until=false && \

extra/init-files/Project.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
</PropertyGroup>
6+
</Project>

extra/tests/c#-dotnet/Main.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public class Hello {
2+
public static void Main() {
3+
System.Console.WriteLine("hello, world");
4+
}
5+
}

extra/tests/c#-dotnet/lang.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VERSIONS="3.1.302"
2+
NAME="C# (.NET Core SDK $VERSION)"
3+
SOURCE_FILE="Main.cs"
4+
BINARY_FILE=""
5+
COMPILE_CMD="cp /init-files/Project.csproj . && mkdir -p ~/.dotnet && touch ~/.dotnet/$VERSION.dotnetFirstUseSentinel && /usr/bin/dotnet build $ARGS Project.csproj"
6+
RUN_CMD="/usr/bin/dotnet run --no-build Project.csproj $ARGS"

extra/tests/c#-mono/Main.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public class Hello {
2+
public static void Main() {
3+
var name = System.Console.ReadLine();
4+
System.Console.WriteLine("hello, " + name);
5+
}
6+
}

extra/tests/c#-mono/lang.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VERSIONS="6.10.0.104"
2+
NAME="C# (Mono $VERSION)"
3+
SOURCE_FILE="Main.cs"
4+
BINARY_FILE="Main.exe"
5+
COMPILE_CMD="/usr/bin/mcs $ARGS $SOURCE_FILE"
6+
RUN_CMD="/usr/bin/mono $BINARY_FILE $ARGS"

extra/tests/f#-dotnet/lang.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
VERSIONS="3.1.302"
2+
NAME="F# (.NET Core SDK $VERSION)"
3+
SOURCE_FILE="script.fsx"
4+
BINARY_FILE=""
5+
COMPILE_CMD=""
6+
RUN_CMD="mkdir -p ~/.dotnet && touch ~/.dotnet/$VERSION.dotnetFirstUseSentinel && /usr/bin/dotnet fsi $SOURCE_FILE $ARGS"

extra/tests/f#-dotnet/script.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
printfn "hello, world"

extra/tests/run

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ for directory in *; do
8080

8181
set +e
8282
isolate --cg -i /dev/null -t 15 -x 0 -w 20 -k 128000 -p120 --cg-timing --cg-mem=512000 -f 10240 \
83-
-E HOME=$workdir -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
84-
-E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec -d /usr/local/BosqueLanguage/impl:rw --run -- /bin/bash compile
83+
-E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
84+
-E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec -d /init-files:noexec -d /usr/local/BosqueLanguage/impl:rw --run -- /bin/bash compile
8585

8686
if [[ $? != 0 ]]; then
8787
if [[ $SKIP_CLEANUP != true ]]; then
@@ -107,9 +107,9 @@ for directory in *; do
107107
echo "Running inside isolate."
108108

109109
set +e
110-
isolate --cg -t 2 -x 0.5 -w 5 -k 64000 -p60 --cg-timing --cg-mem=128000 --share-net -f 5120 \
111-
-E HOME=$workdir -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
112-
-E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec --run -- /bin/bash run < $workdir/stdin
110+
isolate --cg -t 5 -x 0.5 -w 5 -k 64000 -p60 --cg-timing --cg-mem=128000 --share-net -f 5120 \
111+
-E HOME=/tmp -E PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
112+
-E LANG -E LANGUAGE -E LC_ALL -d /etc:noexec -d /init-files:noexec --run -- /bin/bash run < $workdir/stdin
113113

114114
if [[ $? != 0 ]]; then
115115
exit_after_cleanup=true

extra/tests/vb-mono/Main.vb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Public Module Program
2+
Public Sub Main()
3+
Console.WriteLine("hello, world")
4+
End Sub
5+
End Module

0 commit comments

Comments
 (0)