diff --git a/aws_lambda_builders/validator.py b/aws_lambda_builders/validator.py index 86b720e13..0c6d13d8c 100644 --- a/aws_lambda_builders/validator.py +++ b/aws_lambda_builders/validator.py @@ -24,7 +24,6 @@ "java11": [ARM64, X86_64], "java17": [ARM64, X86_64], "go1.x": [ARM64, X86_64], - "dotnetcore3.1": [ARM64, X86_64], "dotnet6": [ARM64, X86_64], "provided": [ARM64, X86_64], } diff --git a/aws_lambda_builders/workflows/dotnet_clipackage/DESIGN.md b/aws_lambda_builders/workflows/dotnet_clipackage/DESIGN.md index 34ccb0e3c..a95c6e8f2 100644 --- a/aws_lambda_builders/workflows/dotnet_clipackage/DESIGN.md +++ b/aws_lambda_builders/workflows/dotnet_clipackage/DESIGN.md @@ -41,7 +41,7 @@ package: The name of the zip file to package the project into Options: -c | --configuration Configuration to build with, for example Release or Debug. - -f | --framework Target framework to compile, for example netcoreapp2.1. + -f | --framework Target framework to compile, for example net6.0. --msbuild-parameters Additional msbuild parameters passed to the 'dotnet publish' command. Add quotes around the value if the value contains spaces. -pl | --project-location The location of the project, if not set the current directory will be assumed. -cfg | --config-file Configuration file storing default values for command line arguments. diff --git a/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py b/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py index 23a1c7144..1cbf0fa19 100644 --- a/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py +++ b/aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py @@ -50,7 +50,7 @@ def run(self, args, cwd=None): LOG.debug("executing dotnet: %s", invoke_dotnet) # DotNet output is in system locale dependent encoding - # https://docs.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=netcore-3.1#remarks + # https://learn.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=net-6.0#remarks # "The default code page that the console uses is determined by the system locale." encoding = locale.getpreferredencoding() p = self.os_utils.popen(invoke_dotnet, stdout=self.os_utils.pipe, stderr=self.os_utils.pipe, cwd=cwd) diff --git a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py index dfbf37103..187a9c7ab 100644 --- a/tests/integration/workflows/dotnet_clipackage/test_dotnet.py +++ b/tests/integration/workflows/dotnet_clipackage/test_dotnet.py @@ -16,7 +16,7 @@ class TestDotnetBase(TestCase): """ - Base class for dotnetcore tests + Base class for dotnet tests """ TEST_DATA_FOLDER = os.path.join(os.path.dirname(__file__), "testdata") @@ -25,7 +25,7 @@ def setUp(self): self.artifacts_dir = tempfile.mkdtemp() self.scratch_dir = tempfile.mkdtemp() self.builder = LambdaBuilder(language="dotnet", dependency_manager="cli-package", application_framework=None) - self.runtime = "dotnetcore3.1" + self.runtime = "dotnet6" def tearDown(self): shutil.rmtree(self.artifacts_dir) @@ -50,80 +50,6 @@ def verify_execute_permissions(self, entrypoint_file_name): self.assertTrue(os.access(entrypoint_file_path, os.X_OK)) -class TestDotnet31(TestDotnetBase): - """ - Tests for dotnetcore 3.1 - """ - - def setUp(self): - super(TestDotnet31, self).setUp() - self.runtime = "dotnetcore3.1" - - def test_with_defaults_file(self): - source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1") - - self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime) - - expected_files = { - "Amazon.Lambda.Core.dll", - "Amazon.Lambda.Serialization.Json.dll", - "Newtonsoft.Json.dll", - "WithDefaultsFile.deps.json", - "WithDefaultsFile.dll", - "WithDefaultsFile.pdb", - "WithDefaultsFile.runtimeconfig.json", - } - - output_files = set(os.listdir(self.artifacts_dir)) - - self.assertEqual(expected_files, output_files) - self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64") - - def test_with_defaults_file_x86(self): - source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1") - - self.builder.build( - source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=X86_64 - ) - - expected_files = { - "Amazon.Lambda.Core.dll", - "Amazon.Lambda.Serialization.Json.dll", - "Newtonsoft.Json.dll", - "WithDefaultsFile.deps.json", - "WithDefaultsFile.dll", - "WithDefaultsFile.pdb", - "WithDefaultsFile.runtimeconfig.json", - } - - output_files = set(os.listdir(self.artifacts_dir)) - - self.assertEqual(expected_files, output_files) - self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64") - - def test_with_defaults_file_arm64(self): - source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1") - - self.builder.build( - source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=ARM64 - ) - - expected_files = { - "Amazon.Lambda.Core.dll", - "Amazon.Lambda.Serialization.Json.dll", - "Newtonsoft.Json.dll", - "WithDefaultsFile.deps.json", - "WithDefaultsFile.dll", - "WithDefaultsFile.pdb", - "WithDefaultsFile.runtimeconfig.json", - } - - output_files = set(os.listdir(self.artifacts_dir)) - - self.assertEqual(expected_files, output_files) - self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64") - - class TestDotnet6(TestDotnetBase): """ Tests for dotnet 6 diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/RequireParameters/RequireParameters.csproj b/tests/integration/workflows/dotnet_clipackage/testdata/RequireParameters/RequireParameters.csproj index 45c85fd29..5db764810 100644 --- a/tests/integration/workflows/dotnet_clipackage/testdata/RequireParameters/RequireParameters.csproj +++ b/tests/integration/workflows/dotnet_clipackage/testdata/RequireParameters/RequireParameters.csproj @@ -1,6 +1,6 @@ - netcoreapp2.1 + net6.0 true Lambda diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/Function.cs b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/Function.cs deleted file mode 100644 index 23fc86994..000000000 --- a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/Function.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -using Amazon.Lambda.Core; - -// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. -[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] - -namespace WithDefaultsFile -{ - public class Function - { - - /// - /// A simple function that takes a string and does a ToUpper - /// - /// - /// - /// - public string FunctionHandler(string input, ILambdaContext context) - { - return input?.ToUpper(); - } - } -} diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/WithDefaultsFile.csproj b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/WithDefaultsFile.csproj deleted file mode 100644 index fc380827b..000000000 --- a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/WithDefaultsFile.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - netcoreapp3.1 - true - Lambda - - - - - - \ No newline at end of file diff --git a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/aws-lambda-tools-defaults.json b/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/aws-lambda-tools-defaults.json deleted file mode 100644 index 56786ebd2..000000000 --- a/tests/integration/workflows/dotnet_clipackage/testdata/WithDefaultsFile3.1/aws-lambda-tools-defaults.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "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", - "framework": "netcoreapp3.1", - "function-runtime": "dotnetcore3.1", - "function-memory-size": 256, - "function-timeout": 30, - "function-handler": "WithDefaultsFile::WithDefaultsFile.Function::FunctionHandler" -} \ No newline at end of file diff --git a/tests/unit/workflows/dotnet_clipackage/test_actions.py b/tests/unit/workflows/dotnet_clipackage/test_actions.py index d4f3380c4..2005155ca 100644 --- a/tests/unit/workflows/dotnet_clipackage/test_actions.py +++ b/tests/unit/workflows/dotnet_clipackage/test_actions.py @@ -156,7 +156,7 @@ def test_build_package_arm64(self): def test_build_package_arguments(self): mode = "Release" - options = {"--framework": "netcoreapp2.1"} + options = {"--framework": "net6.0"} action = RunPackageAction( self.source_dir, self.subprocess_dotnet, self.artifacts_dir, options, mode, os_utils=self.os_utils ) @@ -176,7 +176,7 @@ def test_build_package_arguments(self): "--msbuild-parameters", "--runtime linux-x64", "--framework", - "netcoreapp2.1", + "net6.0", ], cwd="/source_dir", )