Skip to content

Commit fcf47ef

Browse files
committed
feat: add support for dotnet10 runtime
1 parent b50b38d commit fcf47ef

15 files changed

Lines changed: 102 additions & 8 deletions

File tree

samcli/commands/build/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
2. Nodejs 24.x, 22.x, 20.x, 18.x, 16.x, 14.x, 12.x using NPM\n
6161
3. Ruby 3.2, 3.3, 3.4 using Bundler\n
6262
4. Java 8, Java 11, Java 17, Java 21, Java 25 using Gradle and Maven\n
63-
5. Dotnet8, Dotnet6 using Dotnet CLI\n
63+
5. Dotnet6, Dotnet8, Dotnet10 using Dotnet CLI\n
6464
6. Go 1.x using Go Modules (without --use-container)\n
6565
"""
6666

samcli/lib/build/workflow_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def get_layer_subfolder(build_workflow: str) -> str:
108108
"java25": "java",
109109
"dotnet6": "dotnet",
110110
"dotnet8": "dotnet",
111+
"dotnet10": "dotnet",
111112
# User is responsible for creating subfolder in these workflows
112113
"makefile": "",
113114
}
@@ -174,6 +175,7 @@ def get_workflow_config(
174175
"ruby3.4": BasicWorkflowSelector(RUBY_BUNDLER_CONFIG),
175176
"dotnet6": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
176177
"dotnet8": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
178+
"dotnet10": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
177179
"go1.x": BasicWorkflowSelector(GO_MOD_CONFIG),
178180
# When Maven builder exists, add to this list so we can automatically choose a builder based on the supported
179181
# manifest

samcli/lib/utils/architecture.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"go1.x": [X86_64],
3939
"dotnet6": [ARM64, X86_64],
4040
"dotnet8": [ARM64, X86_64],
41+
"dotnet10": [ARM64, X86_64],
4142
"provided": [X86_64],
4243
"provided.al2": [ARM64, X86_64],
4344
"provided.al2023": [ARM64, X86_64],

samcli/local/common/runtime_template.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
],
4949
"dotnet": [
5050
{
51-
"runtimes": ["dotnet8", "dotnet6"],
51+
"runtimes": ["dotnet10", "dotnet8", "dotnet6"],
5252
"dependency_manager": "cli-package",
5353
"init_location": os.path.join(_templates, "cookiecutter-aws-sam-hello-dotnet"),
5454
"build": True,
@@ -107,6 +107,7 @@ def get_local_lambda_images_location(mapping, runtime):
107107
# Runtimes are ordered in alphabetical fashion with reverse version order (latest versions first)
108108
INIT_RUNTIMES = [
109109
# dotnet runtimes in descending order
110+
"dotnet10",
110111
"dotnet8",
111112
"dotnet6",
112113
# go runtimes in descending order
@@ -143,6 +144,7 @@ def get_local_lambda_images_location(mapping, runtime):
143144

144145

145146
LAMBDA_IMAGES_RUNTIMES_MAP = {
147+
"dotnet10": "amazon/dotnet10-base",
146148
"dotnet8": "amazon/dotnet8-base",
147149
"dotnet6": "amazon/dotnet6-base",
148150
"go1.x": "amazon/go1.x-base",
@@ -190,6 +192,7 @@ def get_local_lambda_images_location(mapping, runtime):
190192
"python3.14": "Python36",
191193
"dotnet6": "dotnet6",
192194
"dotnet8": "dotnet6",
195+
"dotnet10": "dotnet6",
193196
"go1.x": "Go1",
194197
"provided.al2": "Go1",
195198
}

samcli/local/docker/lambda_debug_settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def get_debug_settings(debug_port, debug_args_list, _container_env_vars, runtime
111111
entry + ["/var/runtime/bootstrap"] + debug_args_list,
112112
container_env_vars={"_AWS_LAMBDA_DOTNET_DEBUGGING": "1", **_container_env_vars},
113113
),
114+
Runtime.dotnet10.value: lambda: DebugSettings(
115+
entry + ["/var/runtime/bootstrap"] + debug_args_list,
116+
container_env_vars={"_AWS_LAMBDA_DOTNET_DEBUGGING": "1", **_container_env_vars},
117+
),
114118
Runtime.go1x.value: lambda: DebugSettings(
115119
entry,
116120
container_env_vars={

samcli/local/docker/lambda_image.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class Runtime(Enum):
6464
go1x = "go1.x"
6565
dotnet6 = "dotnet6"
6666
dotnet8 = "dotnet8"
67+
dotnet10 = "dotnet10"
6768
provided = "provided"
6869
providedal2 = "provided.al2"
6970
providedal2023 = "provided.al2023"

schema/samcli.json

Lines changed: 8 additions & 5 deletions
Large diffs are not rendered by default.

tests/integration/buildcmd/test_build_cmd_dotnet.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ def test_dotnet_6(self, runtime, code_uri, mode, mount_mode):
9090
("dotnet8", "Dotnet8", None, MountMode.WRITE),
9191
("dotnet8", "Dotnet8", "debug", None),
9292
("dotnet8", "Dotnet8", "debug", MountMode.WRITE),
93+
("dotnet10", "Dotnet10", None, None),
94+
("dotnet10", "Dotnet10", None, MountMode.WRITE),
95+
("dotnet10", "Dotnet10", "debug", None),
96+
("dotnet10", "Dotnet10", "debug", MountMode.WRITE),
9397
]
9498
)
9599
@skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE)
@@ -151,6 +155,8 @@ def test_dotnet_6_in_container(self, runtime, code_uri, mode):
151155
[
152156
("dotnet8", "Dotnet8", None),
153157
("dotnet8", "Dotnet8", "debug"),
158+
("dotnet10", "Dotnet10", None),
159+
("dotnet10", "Dotnet10", "debug"),
154160
]
155161
)
156162
@skipIf(SKIP_DOCKER_TESTS or SKIP_DOCKER_BUILD, SKIP_DOCKER_MESSAGE)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" />
10+
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.0" />
11+
<PackageReference Include="Amazon.Lambda.Serialization.Json" Version="2.2.0" />
12+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
13+
</ItemGroup>
14+
15+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Amazon.Lambda.Core;
2+
using Amazon.Lambda.APIGatewayEvents;
3+
4+
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
5+
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
6+
7+
namespace HelloWorld
8+
{
9+
10+
public class Function
11+
{
12+
13+
public string FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
14+
{
15+
return "{'message': 'Hello World'}";
16+
}
17+
}
18+
19+
public class FirstFunction
20+
{
21+
22+
public string FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
23+
{
24+
return "Hello World";
25+
}
26+
}
27+
28+
public class SecondFunction
29+
{
30+
31+
public string FunctionHandler(APIGatewayProxyRequest apigProxyEvent, ILambdaContext context)
32+
{
33+
return "Hello Mars";
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)