Skip to content

Commit

Permalink
Function: add support for dotnet 8 runtime (#3734)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Blair <blair.nicholas@gmail.com>
  • Loading branch information
Nick and blair55 committed Apr 8, 2024
1 parent d67d9c9 commit b2ecaeb
Show file tree
Hide file tree
Showing 13 changed files with 112 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/heavy-squids-scream.md
@@ -0,0 +1,5 @@
---
"sst": patch
---

Function: add support for dotnet 8 runtime
1 change: 1 addition & 0 deletions packages/sst/src/constructs/Function.ts
Expand Up @@ -79,6 +79,7 @@ const supportedRuntimes = {
"python3.12": CDKRuntime.PYTHON_3_12,
"dotnetcore3.1": CDKRuntime.DOTNET_CORE_3_1,
dotnet6: CDKRuntime.DOTNET_6,
dotnet8: CDKRuntime.DOTNET_8,
java8: CDKRuntime.JAVA_8,
java11: CDKRuntime.JAVA_11,
java17: CDKRuntime.JAVA_17,
Expand Down
2 changes: 2 additions & 0 deletions packages/sst/src/runtime/handlers/dotnet.ts
Expand Up @@ -14,6 +14,7 @@ const FRAMEWORK_MAP: Record<string, string> = {
"dotnetcore2.1": "netcoreapp3.1",
"dotnetcore3.1": "netcoreapp3.1",
dotnet6: "net6.0",
dotnet8: "net8.0",
};

const BOOTSTRAP_MAP: Record<string, string> = {
Expand All @@ -22,6 +23,7 @@ const BOOTSTRAP_MAP: Record<string, string> = {
"dotnetcore2.1": "dotnet31-bootstrap",
"dotnetcore3.1": "dotnet31-bootstrap",
dotnet6: "dotnet6-bootstrap",
dotnet8: "dotnet8-bootstrap",
};

export const useDotnetHandler = (): RuntimeHandler => {
Expand Down
3 changes: 3 additions & 0 deletions packages/sst/support/dotnet8-bootstrap/.gitignore
@@ -0,0 +1,3 @@
# Build results
[Bb]in/
[Oo]bj/
17 changes: 17 additions & 0 deletions packages/sst/support/dotnet8-bootstrap/Program.cs
@@ -0,0 +1,17 @@
using System.Reflection;
using System.Threading.Tasks;
using Amazon.Lambda.RuntimeSupport;

namespace dotnet_bootstrap
{
class Program
{
static async Task Main(string[] args)
{
Assembly asm = Assembly.LoadFrom(args[0]);
var r = new RuntimeSupportInitializer(args[1]);
await r.RunLambdaBootstrap();
}
}
}

12 changes: 12 additions & 0 deletions packages/sst/support/dotnet8-bootstrap/dotnet-bootstrap.csproj
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>dotnet_bootstrap</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.10.0" />
</ItemGroup>

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,59 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"dotnet-bootstrap/1.0.0": {
"dependencies": {
"Amazon.Lambda.RuntimeSupport": "1.10.0"
},
"runtime": {
"dotnet-bootstrap.dll": {}
}
},
"Amazon.Lambda.Core/2.2.0": {
"runtime": {
"lib/net8.0/Amazon.Lambda.Core.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Amazon.Lambda.RuntimeSupport/1.10.0": {
"dependencies": {
"Amazon.Lambda.Core": "2.2.0"
},
"runtime": {
"lib/net8.0/Amazon.Lambda.RuntimeSupport.dll": {
"assemblyVersion": "1.10.0.0",
"fileVersion": "1.10.0.0"
}
}
}
}
},
"libraries": {
"dotnet-bootstrap/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Amazon.Lambda.Core/2.2.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-DHqKeD1CYocP0t1dJC/NaXfu+5k6AoqnQ1Hlu/J2mXpLpCyeJfY+tIqT5fpruDarUlU0NtdIH8zSkCjeinyb1A==",
"path": "amazon.lambda.core/2.2.0",
"hashPath": "amazon.lambda.core.2.2.0.nupkg.sha512"
},
"Amazon.Lambda.RuntimeSupport/1.10.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-J1NdaUV24sWALmCjzJJ6vezskeeH2NxJU7ao86rgdzW+AcgnhYjIULuKQNAx6fTl8AP/8acFsq7Jp7k156hh4A==",
"path": "amazon.lambda.runtimesupport/1.10.0",
"hashPath": "amazon.lambda.runtimesupport.1.10.0.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

0 comments on commit b2ecaeb

Please sign in to comment.