Skip to content

Commit ccfba61

Browse files
authored
Merge pull request #333 from esa/DOTNET9
Dotnet9
2 parents b2aa7bd + a003b27 commit ccfba61

40 files changed

+196
-131
lines changed

Antlr/Antlr.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
66
</PropertyGroup>
77

Asn1sccWs/Asn1sccWs.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>

BackendAst/BackendAst.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net7.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<GenerateDocumentationFile>true</GenerateDocumentationFile>
55
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
66
</PropertyGroup>
@@ -56,6 +56,6 @@
5656
</Reference>
5757
</ItemGroup>
5858
<ItemGroup>
59-
<PackageReference Update="FSharp.Core" Version="7.0.400" />
59+
<PackageReference Update="FSharp.Core" Version="9.0.300-beta.25079.4" />
6060
</ItemGroup>
6161
</Project>

BackendAst/DAstACN.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ let createSequenceFunction (r:Asn1AcnAst.AstRoot) (deps:Asn1AcnAst.AcnInsertedFi
20502050
if presentWhenStmts.IsNone && childBody.IsNone then [], None
20512051
else
20522052
let combinedBody (p: CallerScope) (existVar: string option): string =
2053-
((presentWhenStmts |> Option.toList) @ (childBody |> Option.toList) |> List.map (fun f -> f p existVar)).StrJoin "\n"
2053+
((presentWhenStmts |> Option.toList) @ (childBody |> Option.toList) |> List.map (fun f -> f p existVar)) |> Seq.StrJoin "\n"
20542054
let soc = {SequenceOptionalChild.t = t; sq = o; child = child; existVar = existVar; p = {p with arg = childSel}; nestingScope = childNestingScope; childBody = combinedBody}
20552055
let optAux, theCombinedBody = lm.lg.generateOptionalAuxiliaries r ACN soc codec
20562056
optAux, Some theCombinedBody

CommonTypes/CommonTypes.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
77
</PropertyGroup>
@@ -45,7 +45,7 @@
4545
</ItemGroup>
4646

4747
<ItemGroup>
48-
<PackageReference Update="FSharp.Core" Version="7.0.400" />
48+
<PackageReference Update="FSharp.Core" Version="9.0.300-beta.25079.4" />
4949
</ItemGroup>
5050

5151
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">

CommonTypes/FsUtils.fs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -407,16 +407,6 @@ type System.Int32 with
407407
member x.AsBigInt = BigInteger x
408408

409409

410-
type System.Collections.Generic.IEnumerable<'T> with
411-
member t.StrJoin str =
412-
if Seq.isEmpty(t) then
413-
""
414-
else
415-
t |> Seq.map(fun x -> x.ToString()) |> Seq.reduce(fun agr el -> agr + str + el.ToString())
416-
417-
418-
419-
420410

421411
module List =
422412
let rec contains item lst =

Dockerfile

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,51 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
1+
# Use build arguments to control user creation
2+
ARG NON_ROOT_USER=false
3+
ARG USERNAME=root
4+
ARG USERID=0
25

6+
FROM ubuntu:20.04
7+
8+
# Install .NET
9+
RUN apt-get update && apt-get install -y wget apt-transport-https && \
10+
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
11+
dpkg -i packages-microsoft-prod.deb && \
12+
apt-get update && apt-get install -y dotnet-sdk-9.0
13+
14+
# Install system dependencies
315
RUN set -xe \
416
&& DEBIAN_FRONTEND=noninteractive apt-get update -y \
5-
&& apt-get install -y libfontconfig libdbus-1-3 libx11-6 libx11-xcb-dev cppcheck htop \
6-
python3 python3-distutils gcc g++ make nuget libgit2-dev libssl-dev \
17+
&& apt-get install -y libfontconfig libdbus-1-3 libx11-6 libx11-xcb-dev cppcheck htop \
18+
python3 python3-distutils gcc g++ make nuget libgit2-dev libssl-dev curl wget git unzip zip \
719
&& rm -rf /var/lib/apt/lists/* \
820
&& apt-get purge --auto-remove \
921
&& apt-get clean
1022

11-
# this SHELL command is needed to allow using source
12-
SHELL ["/bin/bash", "-c"]
13-
# Install dependencies for scala backend
14-
RUN apt-get update -y \
15-
&& apt-get install -y curl wget unzip zip \
16-
&& curl -s "https://get.sdkman.io" | bash \
17-
&& chmod a+x "$HOME/.sdkman/bin/sdkman-init.sh" \
18-
&& source "$HOME/.sdkman/bin/sdkman-init.sh" \
19-
&& sdk install java 17.0.9-oracle \
20-
&& sdk install scala 3.3.0 \
21-
&& sdk install sbt 1.9.0
22-
23-
# Install GNAT AND SPARK from AdaCore
24-
WORKDIR /gnat_tmp/
23+
# Conditionally create non-root user and set permissions
24+
RUN if [ "$NON_ROOT_USER" = "true" ]; then \
25+
adduser --disabled-password --gecos '' --uid $USERID $USERNAME && \
26+
mkdir -p /workdir /app && \
27+
chown -R $USERNAME:$USERNAME /workdir /app; \
28+
fi
2529

26-
# The ADD instruction will always download the file and the cache will be invalidated if the checksum of the file no longer matches
27-
# On the other hand, the RUN instruction will not invalidate the cache unless its text changes.
28-
# So if the remote file is updated, you won't get it. Docker will use the cached layer.
29-
# In our case, the gnat-2021-20210519-x86_64-linux-bin will not change. So, it is preferable to ADD
30-
#ADD https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin ./gnat-2021-20210519-x86_64-linux-bin
31-
32-
RUN wget -O gnat-2021-20210519-x86_64-linux-bin https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin \
33-
&& git clone https://github.com/AdaCore/gnat_community_install_script.git \
34-
&& chmod +x gnat_community_install_script/install_package.sh \
35-
&& chmod +x gnat-2021-20210519-x86_64-linux-bin \
36-
&& gnat_community_install_script/install_package.sh ./gnat-2021-20210519-x86_64-linux-bin /opt/GNAT/gnat-x86-2021 \
37-
&& cd \
38-
&& rm -rf /gnat_tmp/ \
39-
&& sed -i 's/# alias l=/alias l=/' ~/.bashrc \
40-
&& sed -i 's/# export LS_OPTIONS/export LS_OPTIONS/' ~/.bashrc
30+
# Switch to the appropriate user
31+
USER $USERNAME
4132

42-
WORKDIR /app/
33+
# Install SDKMAN
34+
RUN curl -s "https://get.sdkman.io" | bash && \
35+
echo "source $HOME/.sdkman/bin/sdkman-init.sh" >> $HOME/.bashrc && \
36+
bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.9-oracle && sdk install scala 3.3.0 && sdk install sbt 1.9.0"
4337

38+
# Install GNAT and SPARK (temporarily switch back to root)
39+
USER root
40+
WORKDIR /gnat_tmp/
41+
RUN wget -O gnat-2021-x86_64-linux-bin https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin \
42+
&& git clone https://github.com/AdaCore/gnat_community_install_script.git \
43+
&& chmod +x gnat_community_install_script/install_package.sh \
44+
&& chmod +x gnat-2021-x86_64-linux-bin \
45+
&& gnat_community_install_script/install_package.sh ./gnat-2021-x86_64-linux-bin /opt/GNAT/gnat-x86-2021 \
46+
&& rm -rf /gnat_tmp/
47+
48+
# Set back to the appropriate user
49+
USER $USERNAME
50+
WORKDIR /app/
4451
ENV PATH="/opt/GNAT/gnat-x86-2021/bin:${PATH}"
45-
#ENTRYPOINT ["/bin/bash"]

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
1+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
22

33
RUN set -xe \
44
&& DEBIAN_FRONTEND=noninteractive apt-get update -y \

Dockerfile.local.wsl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Use build arguments to control user creation
2+
ARG NON_ROOT_USER=false
3+
ARG USERNAME=root
4+
ARG USERID=0
5+
6+
FROM ubuntu:20.04
7+
8+
# Install .NET
9+
RUN apt-get update && apt-get install -y wget apt-transport-https && \
10+
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb && \
11+
dpkg -i packages-microsoft-prod.deb && \
12+
apt-get update && apt-get install -y dotnet-sdk-9.0
13+
14+
# Install system dependencies
15+
RUN set -xe \
16+
&& DEBIAN_FRONTEND=noninteractive apt-get update -y \
17+
&& apt-get install -y libfontconfig libdbus-1-3 libx11-6 libx11-xcb-dev cppcheck htop \
18+
python3 python3-distutils gcc g++ make nuget libgit2-dev libssl-dev curl wget git unzip zip \
19+
&& rm -rf /var/lib/apt/lists/* \
20+
&& apt-get purge --auto-remove \
21+
&& apt-get clean
22+
23+
# Conditionally create non-root user and set permissions
24+
RUN if [ "$NON_ROOT_USER" = "true" ]; then \
25+
adduser --disabled-password --gecos '' --uid $USERID $USERNAME && \
26+
mkdir -p /workdir /app && \
27+
chown -R $USERNAME:$USERNAME /workdir /app; \
28+
fi
29+
30+
# Switch to the appropriate user
31+
USER $USERNAME
32+
33+
# Install SDKMAN
34+
RUN curl -s "https://get.sdkman.io" | bash && \
35+
echo "source $HOME/.sdkman/bin/sdkman-init.sh" >> $HOME/.bashrc && \
36+
bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.9-oracle && sdk install scala 3.3.0 && sdk install sbt 1.9.0"
37+
38+
# Install GNAT and SPARK (temporarily switch back to root)
39+
USER root
40+
WORKDIR /gnat_tmp/
41+
RUN wget -O gnat-2021-x86_64-linux-bin https://community.download.adacore.com/v1/f3a99d283f7b3d07293b2e1d07de00e31e332325?filename=gnat-2021-20210519-x86_64-linux-bin \
42+
&& git clone https://github.com/AdaCore/gnat_community_install_script.git \
43+
&& chmod +x gnat_community_install_script/install_package.sh \
44+
&& chmod +x gnat-2021-x86_64-linux-bin \
45+
&& gnat_community_install_script/install_package.sh ./gnat-2021-x86_64-linux-bin /opt/GNAT/gnat-x86-2021 \
46+
&& rm -rf /gnat_tmp/
47+
48+
# Set back to the appropriate user
49+
USER $USERNAME
50+
WORKDIR /app/
51+
ENV PATH="/opt/GNAT/gnat-x86-2021/bin:${PATH}"

Dockerfile.runtime

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
#################################################################################################
66
#################################################################################################
77

8-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder
8+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS builder
99

1010
RUN apt update
1111
#RUN mkdir /usr/share/man/man1
1212
RUN apt install -y python3 python3-distutils \
13-
make openjdk-11-jre nuget libgit2-dev libssl-dev ; apt clean
13+
make openjdk-17-jre nuget libgit2-dev libssl-dev ; apt clean
1414

1515
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
1616
set -ex ;\
@@ -19,7 +19,7 @@ RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/
1919

2020
WORKDIR /src
2121
RUN set -ex ;\
22-
git clone https://github.com/maxime-esa/asn1scc.git ;\
22+
git clone https://github.com/esa/asn1scc.git ;\
2323
cd asn1scc/ ;\
2424
#git checkout dotnetcore ;\
2525
dotnet build Antlr/ --configuration Release ;\
@@ -29,9 +29,9 @@ RUN set -ex ;\
2929
#################################################################################################
3030
#################################################################################################
3131

32-
FROM mcr.microsoft.com/dotnet/runtime:7.0
32+
FROM mcr.microsoft.com/dotnet/runtime:9.0
3333

34-
COPY --from=builder /src/asn1scc/asn1scc/bin/Release/net7.0/ /opt/asn1scc
34+
COPY --from=builder /src/asn1scc/asn1scc/bin/Release/net9.0/ /opt/asn1scc
3535
WORKDIR /tmp
3636

3737
ENTRYPOINT ["/opt/asn1scc/asn1scc"]

0 commit comments

Comments
 (0)