diff --git a/.gitignore b/.gitignore
index 501d092293..14fd530d9f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -409,6 +409,8 @@ tests/integration/testdata/buildcmd/Dotnetcore3.1/bin
tests/integration/testdata/buildcmd/Dotnetcore3.1/obj
tests/integration/testdata/buildcmd/Dotnet6/bin
tests/integration/testdata/buildcmd/Dotnet6/obj
+tests/integration/testdata/buildcmd/Dotnet7/bin
+tests/integration/testdata/buildcmd/Dotnet7/obj
tests/integration/testdata/invoke/credential_tests/inprocess/dotnet/STS/obj
# End of https://www.gitignore.io/api/osx,node,macos,linux,python,windows,pycharm,intellij,sublimetext,visualstudiocode
diff --git a/samcli/lib/build/workflow_config.py b/samcli/lib/build/workflow_config.py
index d6b1f55926..ead6490367 100644
--- a/samcli/lib/build/workflow_config.py
+++ b/samcli/lib/build/workflow_config.py
@@ -140,7 +140,10 @@ def get_workflow_config(
namedtuple that represents the Builder Workflow Config
"""
- selectors_by_build_method = {"makefile": BasicWorkflowSelector(PROVIDED_MAKE_CONFIG)}
+ selectors_by_build_method = {
+ "makefile": BasicWorkflowSelector(PROVIDED_MAKE_CONFIG),
+ "dotnet7": BasicWorkflowSelector(DOTNET_CLIPACKAGE_CONFIG),
+ }
selectors_by_runtime = {
"python3.6": BasicWorkflowSelector(PYTHON_PIP_CONFIG),
diff --git a/tests/integration/buildcmd/test_build_cmd.py b/tests/integration/buildcmd/test_build_cmd.py
index 83abd5563d..ea99af8836 100644
--- a/tests/integration/buildcmd/test_build_cmd.py
+++ b/tests/integration/buildcmd/test_build_cmd.py
@@ -951,7 +951,6 @@ class TestBuildCommand_Dotnet_cli_package(BuildIntegBase):
FUNCTION_LOGICAL_ID = "Function"
EXPECTED_FILES_PROJECT_MANIFEST = {
"Amazon.Lambda.APIGatewayEvents.dll",
- "HelloWorld.pdb",
"Amazon.Lambda.Core.dll",
"HelloWorld.runtimeconfig.json",
"Amazon.Lambda.Serialization.Json.dll",
@@ -960,12 +959,17 @@ class TestBuildCommand_Dotnet_cli_package(BuildIntegBase):
"HelloWorld.dll",
}
+ EXPECTED_FILES_PROJECT_MANIFEST_PROVIDED = {
+ "bootstrap",
+ }
+
@parameterized.expand(
[
("dotnetcore3.1", "Dotnetcore3.1", None),
("dotnet6", "Dotnet6", None),
("dotnetcore3.1", "Dotnetcore3.1", "debug"),
("dotnet6", "Dotnet6", "debug"),
+ ("provided.al2", "Dotnet7", None),
]
)
@pytest.mark.flaky(reruns=3)
@@ -976,6 +980,10 @@ def test_with_dotnetcore(self, runtime, code_uri, mode, architecture="x86_64"):
"Handler": "HelloWorld::HelloWorld.Function::FunctionHandler",
"Architectures": architecture,
}
+
+ if runtime == "provided.al2":
+ self.template_path = self.template_path.replace("template.yaml", "template_build_method_dotnet_7.yaml")
+
cmdlist = self.get_command_list(use_container=False, parameter_overrides=overrides)
LOG.info("Running Command: {}".format(cmdlist))
@@ -988,7 +996,11 @@ def test_with_dotnetcore(self, runtime, code_uri, mode, architecture="x86_64"):
run_command(cmdlist, cwd=self.working_dir, env=newenv)
self._verify_built_artifact(
- self.default_build_dir, self.FUNCTION_LOGICAL_ID, self.EXPECTED_FILES_PROJECT_MANIFEST
+ self.default_build_dir,
+ self.FUNCTION_LOGICAL_ID,
+ self.EXPECTED_FILES_PROJECT_MANIFEST
+ if runtime != "provided.al2"
+ else self.EXPECTED_FILES_PROJECT_MANIFEST_PROVIDED,
)
self._verify_resource_property(
diff --git a/tests/integration/testdata/buildcmd/Dotnet7/HelloWorld.csproj b/tests/integration/testdata/buildcmd/Dotnet7/HelloWorld.csproj
new file mode 100644
index 0000000000..23eedf4416
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet7/HelloWorld.csproj
@@ -0,0 +1,25 @@
+
+
+
+ net7.0
+ true
+ true
+ true
+ exe
+ bootstrap
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/integration/testdata/buildcmd/Dotnet7/Program.cs b/tests/integration/testdata/buildcmd/Dotnet7/Program.cs
new file mode 100755
index 0000000000..da7d128ea6
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet7/Program.cs
@@ -0,0 +1,38 @@
+using Amazon.Lambda.APIGatewayEvents;
+using Amazon.Lambda.Core;
+using Amazon.Lambda.RuntimeSupport;
+using Amazon.Lambda.Serialization.SystemTextJson;
+using System.Text.Json.Serialization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Net.Http;
+using System.Net.Http.Headers;
+
+namespace HelloWorld;
+
+public class Function
+{
+ ///
+ /// The main entry point for the custom runtime.
+ ///
+ ///
+ private static async Task Main(string[] args)
+ {
+ Func handler = FunctionHandler;
+ await LambdaBootstrapBuilder.Create(handler, new SourceGeneratorLambdaJsonSerializer())
+ .Build()
+ .RunAsync();
+ }
+
+ public static string FunctionHandler(APIGatewayHttpApiV2ProxyRequest apigProxyEvent, ILambdaContext context)
+ {
+ return "{'message': 'Hello World'}";
+ }
+}
+
+[JsonSerializable(typeof(APIGatewayHttpApiV2ProxyRequest))]
+public partial class MyCustomJsonSerializerContext : JsonSerializerContext
+{
+}
diff --git a/tests/integration/testdata/buildcmd/Dotnet7/aws-lambda-tools-defaults.json b/tests/integration/testdata/buildcmd/Dotnet7/aws-lambda-tools-defaults.json
new file mode 100644
index 0000000000..15c8399a21
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet7/aws-lambda-tools-defaults.json
@@ -0,0 +1,18 @@
+{
+ "Information" : [
+ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.",
+ "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.",
+
+ "dotnet lambda help",
+
+ "All the command line options for the Lambda command can be specified in this file."
+ ],
+
+ "profile":"",
+ "region" : "",
+ "configuration": "Release",
+ "function-runtime":"provided.al2",
+ "function-memory-size" : 256,
+ "function-timeout" : 30,
+ "function-handler" : "HelloWorld::HelloWorld.Function::FunctionHandler"
+}
diff --git a/tests/integration/testdata/buildcmd/Dotnet7/rd.xml b/tests/integration/testdata/buildcmd/Dotnet7/rd.xml
new file mode 100644
index 0000000000..6d35e8768c
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/Dotnet7/rd.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/integration/testdata/buildcmd/template_build_method_dotnet_7.yaml b/tests/integration/testdata/buildcmd/template_build_method_dotnet_7.yaml
new file mode 100644
index 0000000000..4902db2fa9
--- /dev/null
+++ b/tests/integration/testdata/buildcmd/template_build_method_dotnet_7.yaml
@@ -0,0 +1,38 @@
+iAWSTemplateFormatVersion : '2010-09-09'
+Transform: AWS::Serverless-2016-10-31
+
+Parameteres:
+ Runtime:
+ Type: String
+ CodeUri:
+ Type: String
+ Handler:
+ Type: String
+
+Resources:
+
+ Function:
+ Type: AWS::Serverless::Function
+ Properties:
+ Handler: !Ref Handler
+ Runtime: !Ref Runtime
+ CodeUri: !Ref CodeUri
+ Timeout: 600
+ Metadata:
+ BuildMethod: dotnet7
+
+ OtherRelativePathResource:
+ Type: AWS::ApiGateway::RestApi
+ Properties:
+ BodyS3Location: SomeRelativePath
+
+ GlueResource:
+ Type: AWS::Glue::Job
+ Properties:
+ Command:
+ ScriptLocation: SomeRelativePath
+
+ ExampleNestedStack:
+ Type: AWS::CloudFormation::Stack
+ Properties:
+ TemplateURL: https://s3.amazonaws.com/examplebucket/exampletemplate.yml
diff --git a/tests/unit/lib/build_module/test_workflow_config.py b/tests/unit/lib/build_module/test_workflow_config.py
index e35d6c05fe..0c30fd9e32 100644
--- a/tests/unit/lib/build_module/test_workflow_config.py
+++ b/tests/unit/lib/build_module/test_workflow_config.py
@@ -51,6 +51,17 @@ def test_must_work_for_provided(self, runtime):
self.assertEqual(len(EventTracker.get_tracked_events()), 1)
self.assertIn(Event("BuildWorkflowUsed", "provided-None"), EventTracker.get_tracked_events())
+ @parameterized.expand([("provided.al2",)])
+ def test_must_work_for_provided_with_build_method_dotnet7(self, runtime):
+ result = get_workflow_config(runtime, self.code_dir, self.project_dir, specified_workflow="dotnet7")
+ self.assertEqual(result.language, "dotnet")
+ self.assertEqual(result.dependency_manager, "cli-package")
+ self.assertEqual(result.application_framework, None)
+ self.assertEqual(result.manifest_name, ".csproj")
+ self.assertIsNone(result.executable_search_paths)
+ self.assertEqual(len(EventTracker.get_tracked_events()), 1)
+ self.assertIn(Event("BuildWorkflowUsed", "dotnet-cli-package"), EventTracker.get_tracked_events())
+
@parameterized.expand([("provided",)])
def test_must_work_for_provided_with_no_specified_workflow(self, runtime):
# Implicitly look for makefile capability.