Skip to content

Commit 89be355

Browse files
committed
update to use dotnet publish
1 parent 6b56f03 commit 89be355

File tree

2 files changed

+36
-33
lines changed

2 files changed

+36
-33
lines changed

Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Amazon.Lambda.TestTool.csproj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@
2121
<PackageReference Include="BlazorMonaco" Version="3.2.0" />
2222
</ItemGroup>
2323

24-
<ItemGroup>
25-
<ProjectReference Include="..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\Amazon.Lambda.RuntimeSupport.csproj" />
26-
</ItemGroup>
24+
<Target Name="CopyRuntimeSupportFiles" BeforeTargets="_GetPackageFiles">
25+
<Message Importance="high" Text="Publishing Amazon.Lambda.RuntimeSupport project..." />
26+
27+
<ItemGroup>
28+
<TargetFrameworks Include="netstandard2.0;net5.0;net6.0;net8.0" />
29+
</ItemGroup>
2730

28-
<ItemGroup>
29-
<RuntimeSupportFramework Include="net5.0;net6.0;net8.0;netstandard2.0" />
30-
</ItemGroup>
31+
<Exec Command="dotnet publish &quot;$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\Amazon.Lambda.RuntimeSupport.csproj&quot; -c $(Configuration) -f %(TargetFrameworks.Identity) -v n" />
3132

32-
<Target Name="ListRuntimeSupportDlls" BeforeTargets="PrepareForBuild">
3333
<ItemGroup>
34-
<Content Include="$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\bin\$(Configuration)\%(RuntimeSupportFramework.Identity)\Amazon.Lambda.RuntimeSupport.dll">
34+
<None Include="$(MSBuildThisFileDirectory)..\..\..\..\Libraries\src\Amazon.Lambda.RuntimeSupport\bin\$(Configuration)\%(TargetFrameworks.Identity)\publish\**\*.*">
3535
<Pack>true</Pack>
36-
<PackagePath>content\%(RuntimeSupportFramework.Identity)</PackagePath>
37-
</Content>
36+
<PackagePath>content\%(TargetFrameworks.Identity)</PackagePath>
37+
</None>
3838
</ItemGroup>
3939
</Target>
4040

Tools/LambdaTestTool-v2/tests/Amazon.Lambda.TestTool.UnitTests/PackagingTests.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -98,45 +98,48 @@ public void VerifyPackageContentsHasRuntimeSupport()
9898
var packageFiles = Directory.GetFiles(packageDir, "*.nupkg", SearchOption.AllDirectories);
9999
Assert.True(packageFiles.Length > 0, $"No .nupkg files found in {packageDir}");
100100

101-
// Rest of the verification code remains the same...
102101
string packagePath = packageFiles[0];
103102
_output.WriteLine($"Found package: {packagePath}");
104103

105104
using (var archive = ZipFile.OpenRead(packagePath))
106105
{
107-
var missingFiles = new List<string>();
108-
106+
// Verify each framework has its required files
109107
foreach (var framework in ExpectedFrameworks)
110108
{
111-
var expectedPath = $"content/{framework}/Amazon.Lambda.RuntimeSupport.dll";
112-
var entry = archive.GetEntry(expectedPath);
109+
_output.WriteLine($"\nChecking framework: {framework}");
110+
111+
// Get all files for this framework
112+
var frameworkFiles = archive.Entries
113+
.Where(e => e.FullName.StartsWith($"content/{framework}/"))
114+
.Select(e => e.FullName)
115+
.ToList();
113116

114-
if (entry == null)
117+
// Verify essential files exist
118+
var essentialFiles = new[]
115119
{
116-
missingFiles.Add(expectedPath);
117-
}
118-
}
120+
$"content/{framework}/Amazon.Lambda.RuntimeSupport.dll",
121+
$"content/{framework}/Amazon.Lambda.RuntimeSupport.deps.json",
122+
$"content/{framework}/bootstrap.sh",
123+
$"content/{framework}/bootstrap-al2023.sh"
124+
};
119125

120-
if (missingFiles.Any())
121-
{
122-
Assert.Fail($"The following RuntimeSupport DLLs are missing from the package:\n" +
123-
string.Join("\n", missingFiles));
124-
}
126+
var missingFiles = essentialFiles.Where(f => !frameworkFiles.Contains(f)).ToList();
125127

126-
var actualFrameworkDlls = archive.Entries
127-
.Where(e => e.FullName.Contains("Amazon.Lambda.RuntimeSupport.dll"))
128-
.Select(e => e.FullName)
129-
.ToList();
128+
if (missingFiles.Any())
129+
{
130+
Assert.Fail($"The following essential files are missing for {framework}:\n" +
131+
string.Join("\n", missingFiles));
132+
}
130133

131-
_output.WriteLine("\nFound DLLs in package:");
132-
foreach (var dll in actualFrameworkDlls)
133-
{
134-
_output.WriteLine(dll);
134+
_output.WriteLine($"Files found for {framework}:");
135+
foreach (var file in frameworkFiles)
136+
{
137+
_output.WriteLine($" {file}");
138+
}
135139
}
136140
}
137141
}
138142

139-
140143
private string FindSolutionRoot()
141144
{
142145
string currentDirectory = Directory.GetCurrentDirectory();

0 commit comments

Comments
 (0)