Skip to content

Commit 686434d

Browse files
committed
Add support for using file-based C# Lambda functions
1 parent 41d380d commit 686434d

File tree

18 files changed

+767
-102
lines changed

18 files changed

+767
-102
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
**/node_modules/
2222
**/TestGenerations/
23+
**/artifacts/
2324

2425
**/.vscode
2526
**/.idea

aws-extensions-for-dotnet-cli.sln

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.1.32228.430
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.3.11222.16 d18.3
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A5EA2C7D-846F-4266-8423-EFC4BA0FE4B6}"
77
EndProject
@@ -69,6 +69,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestIntegerFunction", "test
6969
EndProject
7070
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFunctionBuildProps", "testapps\TestFunctionBuildProps\TestFunctionBuildProps\TestFunctionBuildProps.csproj", "{AFA71B8E-F0AA-4704-8C4E-C11130F82B13}"
7171
EndProject
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SingeFileLambdaFunctions", "SingeFileLambdaFunctions", "{5711F48F-5491-4C8A-92B2-4D6D849483B5}"
73+
ProjectSection(SolutionItems) = preProject
74+
testapps\SingeFileLambdaFunctions\serverless.template = testapps\SingeFileLambdaFunctions\serverless.template
75+
testapps\SingeFileLambdaFunctions\ToUpperFunctionImplicitAOT.cs = testapps\SingeFileLambdaFunctions\ToUpperFunctionImplicitAOT.cs
76+
testapps\SingeFileLambdaFunctions\ToUpperFunctionNoAOT.cs = testapps\SingeFileLambdaFunctions\ToUpperFunctionNoAOT.cs
77+
EndProjectSection
78+
EndProject
7279
Global
7380
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7481
Debug|Any CPU = Debug|Any CPU
@@ -207,6 +214,7 @@ Global
207214
{69FFA03C-D29F-40E0-9E7F-572D5E10AF77} = {BB3CF729-8213-4DDD-85AE-A5E7754F3944}
208215
{D7F1DFA4-066B-469C-B04C-DF032CF152C1} = {BB3CF729-8213-4DDD-85AE-A5E7754F3944}
209216
{AFA71B8E-F0AA-4704-8C4E-C11130F82B13} = {BB3CF729-8213-4DDD-85AE-A5E7754F3944}
217+
{5711F48F-5491-4C8A-92B2-4D6D849483B5} = {BB3CF729-8213-4DDD-85AE-A5E7754F3944}
210218
EndGlobalSection
211219
GlobalSection(ExtensibilityGlobals) = postSolution
212220
SolutionGuid = {DBFC70D6-49A2-40A1-AB08-5D9504AB7112}

src/Amazon.Common.DotNetCli.Tools/Commands/BaseCommand.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,17 @@ public abstract class BaseCommand<TDefaultConfig> : ICommand
3030
public BaseCommand(IToolLogger logger, string workingDirectory)
3131
{
3232
this.Logger = logger;
33-
this.WorkingDirectory = workingDirectory;
33+
34+
// In case working directory was set to a file then use the parent directory as the working directory.
35+
// This can happen in the C# single file scenario.
36+
if (File.Exists(workingDirectory))
37+
{
38+
this.WorkingDirectory = Directory.GetParent(workingDirectory).FullName;
39+
}
40+
else
41+
{
42+
this.WorkingDirectory = workingDirectory;
43+
}
3444
}
3545

3646
public BaseCommand(IToolLogger logger, string workingDirectory, IList<CommandOption> possibleOptions, string[] args)
@@ -753,7 +763,11 @@ private int WaitForIndexResponse(int min, int max)
753763

754764

755765
public IToolLogger Logger { get; protected set; }
756-
public string WorkingDirectory { get; set; }
766+
public string WorkingDirectory
767+
{
768+
get;
769+
set;
770+
}
757771

758772
protected string GetUserAgentString()
759773
{

0 commit comments

Comments
 (0)