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

Merged
1 commit merged into from
Jan 27, 2025

Conversation

ghost
Copy link

@ghost ghost commented Dec 5, 2024

Issue #, if available:

Description of changes:

  1. Add all runtime versions of Amazon.Lambda.RuntimeSupport dll to the output nuget package. each dll is in its own folder in the content folder
  2. Add test to verify dlsl are inside the content folder.

Testing

  1. I copied the outputted dlls into the lampda poc project and verified that they work
    image
    image

image

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

</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
Member

Choose a reason for hiding this comment

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

We will need to distribute each target framework for Lambda RuntimeSupport. That is how things work in Lambda. I think what you are thinking about is I meant with test tool v2 we only need to ship one version of the test tool NuGet package unlike the current v1 version were we ship separate versions of the package for each target framework. In the end we will have a single V2 test tool NuGet package with one .NET tool which is the Lambda emulator and then separate content folders for each version of RuntimeSupport with RuntimeSupport's dependencies.

Copy link
Author

Choose a reason for hiding this comment

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

Ahh ok let me make that change. thanks for the detailed explanation

Copy link
Author

Choose a reason for hiding this comment

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

ive updated it now, where each runtime support target version has its own folder with a dll in the content folder of the test tool

Copy link
Author

Choose a reason for hiding this comment

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

ive also updated the screenshot in the description

Copy link
Author

Choose a reason for hiding this comment

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

I've updated the latest logic to now use dotnet publish and copy everything in the publish folder to the content folder. and i have updated the screenshot in the description

@ghost ghost changed the title add packaging of runtime Add Amazon.Lambda.RuntimeSupport dll to the output nuget package Dec 17, 2024
@ghost ghost marked this pull request as ready for review December 17, 2024 18:35
@ghost ghost requested a review from philasmar December 17, 2024 18:35
Copy link
Contributor

@philasmar philasmar left a comment

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?

@ghost ghost force-pushed the gcbeatty/runtime branch 2 times, most recently from f8aafa1 to 13a74ae Compare January 14, 2025 20:06
</ItemGroup>

<ItemGroup>
<RuntimeSupportFramework Include="net5.0;net6.0;net8.0;netstandard2.0" />
Copy link
Author

Choose a reason for hiding this comment

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

we havent updated runtime support in this branch to add .net9.0 which is why i havent added it here

@ghost ghost requested review from philasmar and normj January 14, 2025 20:13
Copy link
Member

@normj normj left a comment

Choose a reason for hiding this comment

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

Instead of adding the project reference and manually copying the dll I wonder if we should have a customer target that runs before the Pack target and run some script that does a dotnet publish for each supported target. And then copy the output publish folder to a content folder in the test package for each target framework. That would cover all of the dependencies and would be the same as who the Runtime assembly and its dependencies are copied into the image.

Plus having the project dependency even though we don't use it is annoying because it means we have to keep building RuntimeSupport and its dependencies as part of our dev loop.

@ghost
Copy link
Author

ghost commented Jan 15, 2025

Instead of adding the project reference and manually copying the dll I wonder if we should have a customer target that runs before the Pack target and run some script that does a dotnet publish for each supported target. And then copy the output publish folder to a content folder in the test package for each target framework. That would cover all of the dependencies and would be the same as who the Runtime assembly and its dependencies are copied into the image.

Plus having the project dependency even though we don't use it is annoying because it means we have to keep building RuntimeSupport and its dependencies as part of our dev loop.

i have updated the latest logic to do this

@ghost ghost requested a review from normj January 15, 2025 17:26
@ghost ghost force-pushed the gcbeatty/runtime branch from 16f879a to 22180b8 Compare January 15, 2025 18:51
<Message Importance="high" Text="Publishing Amazon.Lambda.RuntimeSupport project..." />

<ItemGroup>
<TargetFrameworks Include="netstandard2.0;net5.0;net6.0;net8.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

You should drop net5 and add net9

Copy link
Author

Choose a reason for hiding this comment

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

the reason i didnt add net9 in this PR was that i saw in the main branch, adding net9 required a bunch of changes. so i was going to do those separately

Copy link
Author

Choose a reason for hiding this comment

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

ive updated this in my local branch but waiting on https://github.com/aws/aws-lambda-dotnet/pull/1937/files to be merged first

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@@ -23,9 +22,25 @@
<PackageReference Include="BlazorMonaco" Version="3.2.0" />
</ItemGroup>

<Target Name="CopyRuntimeSupportFiles" BeforeTargets="_GetPackageFiles">
<Message Importance="high" Text="Publishing Amazon.Lambda.RuntimeSupport project..." />
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: message is a bit misleading or non descriptive

Copy link
Author

Choose a reason for hiding this comment

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

yea i iwll remove the message

Copy link
Author

Choose a reason for hiding this comment

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

fixed

{
private readonly ITestOutputHelper _output;
private static readonly string[] ExpectedFrameworks = new[]
{
Copy link
Contributor

Choose a reason for hiding this comment

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

update frameworks here too

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link
Member

Choose a reason for hiding this comment

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

Would be great if instead of having this hardcoded list if you read the TargetFrameworks from the Amazon.Lambda.RuntimeSupport project file. That way we don't have to update this every time we add a new supported version.

You can skip .NET Standard 2.0.

@ghost ghost force-pushed the gcbeatty/runtime branch from 22180b8 to 616d6b2 Compare January 22, 2025 19:21
@ghost ghost requested a review from philasmar January 22, 2025 19:25
@@ -1,14 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<Project Sdk="Microsoft.NET.Sdk.Web">
Copy link
Member

Choose a reason for hiding this comment

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

Because of our unorthodox packaging of the assemblies I'm getting a lot of NU5100 warnings. Can you add <NoWarn>NU5100</NoWarn> to the PropertyGroup.

Copy link
Author

Choose a reason for hiding this comment

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

done

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\bin\$(Configuration)\%(TargetFrameworks.Identity)\publish\**\*.*">
<Pack>true</Pack>
<PackagePath>content\%(TargetFrameworks.Identity)</PackagePath>
Copy link
Member

Choose a reason for hiding this comment

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

Can you change content\%(TargetFrameworks.Identity) to content\Amazon.Lambda.RuntimeSupport\%(TargetFrameworks.Identity) to give some name spacing to the content here.

Copy link
Author

Choose a reason for hiding this comment

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

done

{
private readonly ITestOutputHelper _output;
private static readonly string[] ExpectedFrameworks = new[]
{
Copy link
Member

Choose a reason for hiding this comment

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

Would be great if instead of having this hardcoded list if you read the TargetFrameworks from the Amazon.Lambda.RuntimeSupport project file. That way we don't have to update this every time we add a new supported version.

You can skip .NET Standard 2.0.

<Exec Command="dotnet publish &quot;$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\Amazon.Lambda.RuntimeSupport.csproj&quot; -c $(Configuration) -f %(TargetFrameworks.Identity) /p:ExecutableOutputType=true -v n" />

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\bin\$(Configuration)\%(TargetFrameworks.Identity)\publish\**\*.*">
Copy link
Member

Choose a reason for hiding this comment

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

It would be great if we could skip netstandard2.0 because it doesn't make any sense in this context. The netstandard2.0 target is for class libraries not executables.

Copy link
Author

Choose a reason for hiding this comment

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

ive updated the logic in the csproj and the unit test to dynamically get the targetframeworks and also skip netstandard2.0

@ghost ghost added the Release Not Needed Add this label if a PR does not need to be released. label Jan 24, 2025
@ghost ghost requested a review from normj January 24, 2025 16:25
Copy link
Member

@normj normj left a comment

Choose a reason for hiding this comment

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

Nice job. Some impressive MSBuild work here.

@ghost ghost force-pushed the gcbeatty/runtime branch from 3187134 to 1366b57 Compare January 27, 2025 16:59
@ghost ghost merged commit 6c50e10 into feature/lambdatesttool-v2 Jan 27, 2025
5 checks passed
@ghost ghost deleted the gcbeatty/runtime branch January 27, 2025 17:17
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Not Needed Add this label if a PR does not need to be released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants