Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .autover/changes/3fb2215f-52a7-4b5c-8019-65b4c8618452.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Projects": [
{
"Name": "Amazon.Lambda.Tools",
"Type": "Patch",
"ChangelogMessages": [
"Fix: Use function architecture to determine artifact path instead of hardcoded \u0027x64\u0027."
]
}
]
}
7 changes: 4 additions & 3 deletions src/Amazon.Lambda.Tools/Commands/PublishLayerCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ private async Task<CreateLayerZipFileResult> CreateRuntimePackageStoreLayerZipFi
}
var architecture = this.GetStringValueOrDefault(this.Architecture, LambdaDefinedCommandOptions.ARGUMENT_FUNCTION_ARCHITECTURE, false);
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The architecture value retrieved at line 247 should be reused at line 268 instead of calling GetStringValueOrDefault again. This eliminates redundant method calls and ensures consistency. Consider storing the result in a variable with broader scope or moving the variable declaration outside the scope block.

Copilot uses AI. Check for mistakes.
var cliWrapper = new LambdaDotNetCLIWrapper(this.Logger, this.WorkingDirectory);
if(cliWrapper.Store(defaults: this.DefaultConfig,
if (cliWrapper.Store(defaults: this.DefaultConfig,
projectLocation: projectLocation,
outputLocation: storeOutputDirectory,
outputLocation: storeOutputDirectory,
targetFramework: targetFramework,
packageManifest: convertResult.PackageManifest,
architecture: architecture,
Expand All @@ -265,7 +265,8 @@ private async Task<CreateLayerZipFileResult> CreateRuntimePackageStoreLayerZipFi

// The artifact.xml file is generated by the "dotnet store" command that lists the packages that were added to the store.
// It is required during a "dotnet publish" so the NuGet packages in the store will be filtered out.
var artifactXmlPath = Path.Combine(storeOutputDirectory, "x64", targetFramework, "artifact.xml");
var architectureDirectory = this.GetStringValueOrDefault(this.Architecture, LambdaDefinedCommandOptions.ARGUMENT_FUNCTION_ARCHITECTURE, false) ?? "x64";
Copy link

Copilot AI Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This duplicates the GetStringValueOrDefault call from line 247. Reuse the architecture variable from line 247 by declaring it outside the scope block, e.g., var architectureDirectory = architecture ?? \"x64\";. This improves maintainability and ensures both usages reference the same value.

Copilot uses AI. Check for mistakes.
var artifactXmlPath = Path.Combine(storeOutputDirectory, architectureDirectory, targetFramework, "artifact.xml");
if(!File.Exists(artifactXmlPath))
{
throw new LambdaToolsException($"Failed to find artifact.xml file in created local store.", LambdaToolsException.LambdaErrorCode.FailedToFindArtifactZip);
Expand Down
Loading