Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .autover/changes/5450ccb1-5441-4af0-9e84-7db4f788046d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.Tools",
"Type": "Minor",
"ChangelogMessages": [
"Add container build support for .NET 9. This allows Native AOT .NET 9 Lambda function builds."
]
}
]
}
8 changes: 6 additions & 2 deletions src/Amazon.Lambda.Tools/LambdaUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Amazon.Lambda.Tools
{
public static class TargetFrameworkMonikers
{
public const string net90 = "net9.0";
public const string net80 = "net8.0";
public const string net70 = "net7.0";
public const string net60 = "net6.0";
Expand All @@ -46,7 +47,8 @@ public static class TargetFrameworkMonikers
net50,
net60,
net70,
net80
net80,
net90
};
}

Expand All @@ -56,7 +58,7 @@ public static class LambdaUtilities

public static readonly IReadOnlyDictionary<string, string> _lambdaRuntimeToDotnetFramework = new Dictionary<string, string>()
{
{"dotnet8", TargetFrameworkMonikers.net80}, // Use the string version since the SDK hasn't been updated yet.
{Amazon.Lambda.Runtime.Dotnet8.Value, TargetFrameworkMonikers.net80},
{Amazon.Lambda.Runtime.Dotnet6.Value, TargetFrameworkMonikers.net60},
{Amazon.Lambda.Runtime.Dotnetcore31.Value, TargetFrameworkMonikers.netcoreapp31},
{Amazon.Lambda.Runtime.Dotnetcore21.Value, TargetFrameworkMonikers.netcoreapp21},
Expand Down Expand Up @@ -121,6 +123,8 @@ public static string GetDefaultBuildImage(string targetFramework, string archite

switch (targetFramework?.ToLower())
{
case TargetFrameworkMonikers.net90:
return $"public.ecr.aws/sam/build-dotnet9:latest-{architecture}";
case TargetFrameworkMonikers.net80:
return $"public.ecr.aws/sam/build-dotnet8:latest-{architecture}";
case TargetFrameworkMonikers.net70:
Expand Down
4 changes: 4 additions & 0 deletions test/Amazon.Lambda.Tools.Test/UtilitiesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ public void TestSavingDockerfileInDefaults(string dockerfilePath, string project
[InlineData("net7.0", LambdaConstants.ARCHITECTURE_X86_64, "public.ecr.aws/sam/build-dotnet7:latest-x86_64")]
[InlineData("net7.0", " ", "public.ecr.aws/sam/build-dotnet7:latest-x86_64")]
[InlineData("net7.0", LambdaConstants.ARCHITECTURE_ARM64, "public.ecr.aws/sam/build-dotnet7:latest-arm64")]
[InlineData("net8.0", LambdaConstants.ARCHITECTURE_ARM64, "public.ecr.aws/sam/build-dotnet8:latest-arm64")]
[InlineData("net8.0", LambdaConstants.ARCHITECTURE_X86_64, "public.ecr.aws/sam/build-dotnet8:latest-x86_64")]
[InlineData("net9.0", LambdaConstants.ARCHITECTURE_ARM64, "public.ecr.aws/sam/build-dotnet9:latest-arm64")]
[InlineData("net9.0", LambdaConstants.ARCHITECTURE_X86_64, "public.ecr.aws/sam/build-dotnet9:latest-x86_64")]
[InlineData(null, LambdaConstants.ARCHITECTURE_X86_64, "throws")]
[InlineData(null, LambdaConstants.ARCHITECTURE_ARM64, "throws")]
public void GetDefaultBuildImage(string targetFramework, string architecture, string expectedValue)
Expand Down