Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Amazon.Lambda.RuntimeSupport dll to the output nuget package #1897

Open
wants to merge 3 commits into
base: feature/lambdatesttool-v2
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.RuntimeSupport" Version="1.11.0" />
<PackageReference Include="Spectre.Console" Version="0.49.1" />
<PackageReference Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageReference Include="Blazored.Modal" Version="7.3.1" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.11" />
</ItemGroup>

<ItemGroup>
<None Include="$(OutputPath)Amazon.Lambda.RuntimeSupport.dll" Pack="true" PackagePath="content" Visible="false" />
Copy link
Author

Choose a reason for hiding this comment

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

wasnt sure if this needed to be content or lib folder. was seeing this warning when doing pack command

The assembly 'content\Amazon.Lambda.RuntimeSupport.dll' is not inside the 'lib' folder and hence it won't be added as a reference when the package is installed into a project. Move it into the 'lib' folder if it needs to be referenced.

but in our case in we are referencing the dll as part of a command line argument in the aspire proof of concept , so not sure if it really matters

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming this is only adding the current target framework (net8.0) version of RuntimeSupport. I believe we need to add all targets of Runtimesupport. @normj is my assumption correct?

Copy link
Author

Choose a reason for hiding this comment

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

i remember he mentioned when he updated the test tool v2 something about to not worry about the other versions. but ill let him confirm

Copy link
Author

Choose a reason for hiding this comment

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

i still need to test end to end with aspire poc if any more (lambda core dlls) are needed or anything else

</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="wwwroot\**" />
<EmbeddedResource Include="Resources\**" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using Xunit;

namespace Amazon.Lambda.TestTool.UnitTests;

public class PackagingTests
{
[Fact]
public void VerifyPackageContentsHasRuntimeSupport()
Copy link
Author

Choose a reason for hiding this comment

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

added this test case but wasnt sure it was overkill or not

{
string projectPath = Path.Combine(FindSolutionRoot(), "src", "Amazon.Lambda.TestTool", "Amazon.Lambda.TestTool.csproj");

var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"pack {projectPath} -c Release",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};

process.Start();
string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();

Assert.Equal(0, process.ExitCode);

string packagePath = Directory.GetFiles(Path.GetDirectoryName(projectPath), "*.nupkg", SearchOption.AllDirectories)[0];

using (var archive = ZipFile.OpenRead(packagePath))
{
var runtimeSupportDllEntry = archive.GetEntry("content/Amazon.Lambda.RuntimeSupport.dll");
Assert.NotNull(runtimeSupportDllEntry);
}
}

private string FindSolutionRoot()
{
string currentDirectory = Directory.GetCurrentDirectory();
while (currentDirectory != null)
{
string[] solutionFiles = Directory.GetFiles(currentDirectory, "*.sln*");
if (solutionFiles.Length > 0)
{
return currentDirectory;
}
currentDirectory = Directory.GetParent(currentDirectory)?.FullName;
}
throw new Exception("Could not find the solution root directory.");
}


}
Loading