Skip to content

Commit 585c22f

Browse files
committed
Address PR comments.
1 parent f009b8e commit 585c22f

File tree

10 files changed

+49
-49
lines changed

10 files changed

+49
-49
lines changed

aws-extensions-for-dotnet-cli.sln

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ 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}"
72+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SingleFileLambdaFunctions", "SingleFileLambdaFunctions", "{5711F48F-5491-4C8A-92B2-4D6D849483B5}"
7373
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
74+
testapps\SingleFileLambdaFunctions\serverless.template = testapps\SingleFileLambdaFunctions\serverless.template
75+
testapps\SingleFileLambdaFunctions\ToUpperFunctionImplicitAOT.cs = testapps\SingleFileLambdaFunctions\ToUpperFunctionImplicitAOT.cs
76+
testapps\SingleFileLambdaFunctions\ToUpperFunctionNoAOT.cs = testapps\SingleFileLambdaFunctions\ToUpperFunctionNoAOT.cs
7777
EndProjectSection
7878
EndProject
7979
Global

src/Amazon.Common.DotNetCli.Tools/Utilities.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ public static string GetSolutionDirectoryFullPath(string workingDirectory, strin
209209
public static string DeterminePublishLocation(string workingDirectory, string projectLocation, string configuration, string targetFramework)
210210
{
211211
string path;
212-
if (IsSingleFileCSharpFile(projectLocation))
212+
if (IsSingleFileCSharpFile(projectLocation)) // For example projectLocation = /path/to/file.cs
213213
{
214214
// Do not rely on Directory.GetParent() because if this value will eventually run inside a container but
215215
// the host is Windows the slashes and root will get messed up.
216-
int forwardSlashPosition = projectLocation.LastIndexOf('\\');
217-
int backSlashPosition = projectLocation.LastIndexOf('/');
216+
int forwardSlashPosition = projectLocation.LastIndexOf('/');
217+
int backSlashPosition = projectLocation.LastIndexOf('\\');
218218
int position = Math.Max(forwardSlashPosition, backSlashPosition);
219219
var parentFolder = projectLocation.Substring(0, position);
220220

src/Amazon.Lambda.Tools/Amazon.Lambda.Tools.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
the source code here is also copied into the AWS VS Toolkit.
2121
-->
2222
<LangVersion>7.3</LangVersion>
23-
<Version>5.13.2</Version>
23+
<Version>5.13.888</Version>
2424
</PropertyGroup>
2525
<ItemGroup>
2626
<Content Include="Resources\build-lambda-zip.exe">

src/Amazon.Lambda.Tools/LambdaPackager.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -378,33 +378,33 @@ public static IDictionary<string, string> ConvertToMapOfFiles(string rootDirecto
378378
{
379379
if (!doc.RootElement.TryGetProperty("runtimeTarget", out JsonElement runtimeTargetNode))
380380
{
381-
logger?.WriteLine($"Missing runtimeTarget node. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
382-
return null;
383-
}
381+
logger?.WriteLine($"Missing runtimeTarget node. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
382+
return null;
383+
}
384384

385-
string runtimeTarget;
385+
string runtimeTarget;
386386
if (runtimeTargetNode.ValueKind == JsonValueKind.String)
387-
{
387+
{
388388
runtimeTarget = runtimeTargetNode.GetString();
389-
}
389+
}
390390
else if (runtimeTargetNode.TryGetProperty("name", out JsonElement nameElement))
391-
{
391+
{
392392
runtimeTarget = nameElement.GetString();
393-
}
393+
}
394394
else
395-
{
396-
logger?.WriteLine($"Missing runtimeTarget name. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
397-
return null;
398-
}
395+
{
396+
logger?.WriteLine($"Missing runtimeTarget name. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
397+
return null;
398+
}
399399

400400
if (!doc.RootElement.TryGetProperty("targets", out JsonElement targets) || !targets.TryGetProperty(runtimeTarget, out JsonElement target))
401-
{
402-
logger?.WriteLine($"Missing targets node. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
403-
return null;
404-
}
401+
{
402+
logger?.WriteLine($"Missing targets node. Skipping flattening runtime folder because {depsJsonFilepath} is an unrecognized format");
403+
return null;
404+
}
405405

406406
return target.Clone();
407-
}
407+
}
408408
}
409409
catch (Exception e)
410410
{
@@ -571,14 +571,14 @@ private static bool FlattenRuntimeFolder(IToolLogger logger, string publishLocat
571571
if (depRuntimeTarget.Value.TryGetProperty("rid", out JsonElement ridElement))
572572
{
573573
var rid = ridElement.GetString();
574-
if(string.Equals(rid, runtime, StringComparison.Ordinal))
575-
{
574+
if(string.Equals(rid, runtime, StringComparison.Ordinal))
575+
{
576576
copyFileIfNotExist(depRuntimeTarget.Name);
577+
}
577578
}
578579
}
579580
}
580581
}
581-
}
582582

583583
return true;
584584
}
@@ -604,29 +604,29 @@ private static IList<string> CalculateRuntimeHierarchy()
604604
if (!doc.RootElement.TryGetProperty("runtimes", out JsonElement runtimes))
605605
return runtimeHierarchy;
606606

607-
// Use a queue to do a breadth first search through the list of runtimes.
608-
var queue = new Queue<string>();
609-
queue.Enqueue(LambdaConstants.LEGACY_RUNTIME_HIERARCHY_STARTING_POINT);
607+
// Use a queue to do a breadth first search through the list of runtimes.
608+
var queue = new Queue<string>();
609+
queue.Enqueue(LambdaConstants.LEGACY_RUNTIME_HIERARCHY_STARTING_POINT);
610610

611-
while(queue.Count > 0)
612-
{
613-
var runtime = queue.Dequeue();
614-
if (runtimeHierarchy.Contains(runtime))
615-
continue;
611+
while(queue.Count > 0)
612+
{
613+
var runtime = queue.Dequeue();
614+
if (runtimeHierarchy.Contains(runtime))
615+
continue;
616616

617-
runtimeHierarchy.Add(runtime);
617+
runtimeHierarchy.Add(runtime);
618618

619619
if (runtimes.TryGetProperty(runtime, out JsonElement runtimeElement) &&
620620
runtimeElement.TryGetProperty("#import", out JsonElement imports))
621-
{
622-
foreach (JsonElement importedRuntime in imports.EnumerateArray())
623621
{
624-
queue.Enqueue(importedRuntime.GetString());
622+
foreach (JsonElement importedRuntime in imports.EnumerateArray())
623+
{
624+
queue.Enqueue(importedRuntime.GetString());
625+
}
625626
}
626627
}
627628
}
628629
}
629-
}
630630

631631
return runtimeHierarchy;
632632
}

test/Amazon.Lambda.Tools.Integ.Tests/DeployProjectTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public async Task TestDeploySingleCSharpFile()
340340
{
341341
var assembly = this.GetType().GetTypeInfo().Assembly;
342342
var toolLogger = new TestToolLogger(_testOutputHelper);
343-
var csharpFile = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
343+
var csharpFile = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
344344

345345
var functionName = "TestDeploySingleCSharpFile-" + DateTime.Now.Ticks;
346346
var deployFunctionCommand = new DeployFunctionCommand(toolLogger, System.Environment.CurrentDirectory, new string[] { csharpFile });

test/Amazon.Lambda.Tools.Integ.Tests/DeployServerlessTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public async Task TestDeployServerlessReferencingSingleFile()
286286
{
287287
var assembly = this.GetType().GetTypeInfo().Assembly;
288288
var toolLogger = new TestToolLogger(_testOutputHelper);
289-
var templatePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/serverless.template");
289+
var templatePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/serverless.template");
290290

291291
var stackName = "TestDeployServerlessReferencingSingleFile-" + DateTime.Now.Ticks;
292292
var deployServerlessCommand = new DeployServerlessCommand(toolLogger, Environment.CurrentDirectory, new string[] { "--template", templatePath });

test/Amazon.Lambda.Tools.Test/LambdaSingleFilePackageTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public async Task PackageToUpperNoAOTSettingWithArgument()
2727
try
2828
{
2929
var assembly = this.GetType().GetTypeInfo().Assembly;
30-
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
30+
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
3131
var command = new PackageCommand(new TestToolLogger(_testOutputHelper), Environment.CurrentDirectory, new string[] {fullPath, tempFile });
3232

3333
var created = await command.ExecuteAsync();
@@ -52,7 +52,7 @@ public async Task PackageToUpperNoAOTSettingWithProjectLocation()
5252
try
5353
{
5454
var assembly = this.GetType().GetTypeInfo().Assembly;
55-
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
55+
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
5656
var command = new PackageCommand(new TestToolLogger(_testOutputHelper), Environment.CurrentDirectory, new string[] { tempFile, "--project-location", fullPath });
5757

5858
var created = await command.ExecuteAsync();
@@ -78,7 +78,7 @@ public async Task PackageToUpperNoAOTSettingWithProjectLocation()
7878
public void ConfirmUsingNativeAOT(string filename, bool isAot, string msBuildParameters)
7979
{
8080
var assembly = this.GetType().GetTypeInfo().Assembly;
81-
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + $"../../../../../../testapps/SingeFileLambdaFunctions/{filename}");
81+
var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + $"../../../../../../testapps/SingleFileLambdaFunctions/{filename}");
8282
var actualAot = Utilities.LookPublishAotFlag(fullPath, msBuildParameters);
8383

8484
Assert.Equal(isAot, actualAot);
@@ -172,7 +172,7 @@ public void DeterminePublishLocationForSingleFileVsRegularProject()
172172
var assembly = this.GetType().GetTypeInfo().Assembly;
173173

174174
// Test with single file - should use artifacts folder
175-
var singleFilePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
175+
var singleFilePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
176176
var singleFilePublishLocation = Utilities.DeterminePublishLocation(Environment.CurrentDirectory, singleFilePath, "Release", "net10.0");
177177

178178
// Single file should have "artifacts" in the path
@@ -266,7 +266,7 @@ public void GetSolutionDirectoryForSingleFileVsRegularProject()
266266
var assembly = this.GetType().GetTypeInfo().Assembly;
267267

268268
// Test with single file - should return parent directory
269-
var singleFilePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingeFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
269+
var singleFilePath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/SingleFileLambdaFunctions/ToUpperFunctionNoAOT.cs");
270270
var singleFileSolutionDir = Utilities.GetSolutionDirectoryFullPath(Environment.CurrentDirectory, singleFilePath, null);
271271
var expectedSingleFileDir = Path.GetDirectoryName(singleFilePath);
272272
Assert.Equal(expectedSingleFileDir, singleFileSolutionDir);

testapps/SingeFileLambdaFunctions/serverless.template renamed to testapps/SingleFileLambdaFunctions/serverless.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"Description": "Default function",
1515
"MemorySize": 256,
1616
"Timeout": 30,
17-
"Policies": [ "AWSLambda_FullAccess" ]
17+
"Policies": [ "AWSLambdaBasicExecutionRole " ]
1818
}
1919
}
2020
},

0 commit comments

Comments
 (0)