From 3476aef589135d915da2beb05b23e4921ef0d60d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 25 Jun 2022 15:28:44 +0200 Subject: [PATCH] Move and fix NuGet test project --- .github/workflows/dotnet.yml | 24 +++++++++---------- ComputeSharp.sln | 10 +++++++- .../ComputeSharp.NuGet.csproj} | 0 .../Project => ComputeSharp.NuGet}/Program.cs | 0 .../nuget.config | 2 +- .../NativeLibrariesResolverTests.cs | 16 ++++++------- 6 files changed, 30 insertions(+), 22 deletions(-) rename tests/{ComputeSharp.Tests.NativeLibrariesResolver/Project/ComputeSharp.Sample.NuGet.csproj => ComputeSharp.NuGet/ComputeSharp.NuGet.csproj} (100%) rename tests/{ComputeSharp.Tests.NativeLibrariesResolver/Project => ComputeSharp.NuGet}/Program.cs (100%) rename tests/{ComputeSharp.Tests.NativeLibrariesResolver/Project => ComputeSharp.NuGet}/nuget.config (81%) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 2b0e5901..2a9ec01b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -251,23 +251,23 @@ jobs: with: name: nuget_preview path: artifacts - - name: Build ComputeSharp.Sample.NuGet (.NET 6) - run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f net6.0 + - name: Build ComputeSharp.NuGet (.NET 6) + run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f net6.0 shell: cmd - - name: Run ComputeSharp.Sample.NuGet (.NET 6) - run: dotnet samples\ComputeSharp.Sample.NuGet\bin\Release\net6.0\ComputeSharp.Sample.NuGet.dll + - name: Run ComputeSharp.NuGet (.NET 6) + run: dotnet tests\ComputeSharp.NuGet\bin\Release\net6.0\ComputeSharp.NuGet.dll shell: cmd - - name: Build ComputeSharp.Sample.NuGet (.NET Core 3.1) - run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f netcoreapp3.1 -r win-x64 + - name: Build ComputeSharp.NuGet (.NET Core 3.1) + run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f netcoreapp3.1 -r win-x64 shell: cmd - - name: Run ComputeSharp.Sample.NuGet (.NET Core 3.1) - run: samples\ComputeSharp.Sample.NuGet\bin\Release\netcoreapp3.1\win-x64\ComputeSharp.Sample.NuGet.exe + - name: Run ComputeSharp.NuGet (.NET Core 3.1) + run: tests\ComputeSharp.NuGet\bin\Release\netcoreapp3.1\win-x64\ComputeSharp.NuGet.exe shell: cmd - - name: Build ComputeSharp.Sample.NuGet (.NET Framework 4.7.2) - run: dotnet build samples\ComputeSharp.Sample.NuGet\ComputeSharp.Sample.NuGet.csproj -c Release -f net472 /p:Platform=x64 + - name: Build ComputeSharp.NuGet (.NET Framework 4.7.2) + run: dotnet build tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj -c Release -f net472 /p:Platform=x64 shell: cmd - - name: Run ComputeSharp.Sample.NuGet (.NET Framework 4.7.2) - run: samples\ComputeSharp.Sample.NuGet\bin\x64\Release\net472\ComputeSharp.Sample.NuGet.exe + - name: Run ComputeSharp.NuGet (.NET Framework 4.7.2) + run: tests\ComputeSharp.NuGet\bin\x64\Release\net472\ComputeSharp.NuGet.exe shell: cmd # Run the extra tests to validate a number of build and publishing configurations. diff --git a/ComputeSharp.sln b/ComputeSharp.sln index ea5f3016..f6331a3e 100644 --- a/ComputeSharp.sln +++ b/ComputeSharp.sln @@ -28,7 +28,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.SourceGenerators", "src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj", "{EB52CB67-4162-4722-874B-44EA8DA5450E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NuGet", "NuGet", "{FB17EF84-9208-47AC-921F-680CB1DAD8BA}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Packages", "Packages", "{FB17EF84-9208-47AC-921F-680CB1DAD8BA}" ProjectSection(SolutionItems) = preProject src\ComputeSharp.Core.Package\ComputeSharp.Core.Package.msbuildproj = src\ComputeSharp.Core.Package\ComputeSharp.Core.Package.msbuildproj src\ComputeSharp.D2D1.Package\ComputeSharp.D2D1.Package.msbuildproj = src\ComputeSharp.D2D1.Package\ComputeSharp.D2D1.Package.msbuildproj @@ -103,6 +103,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.Tests.Ass EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.Pix", "src\ComputeSharp.Pix\ComputeSharp.Pix.csproj", "{14EF12A3-90E6-4683-BD71-9896AF87026B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ComputeSharp.NuGet", "ComputeSharp.NuGet", "{CBA545B4-31EF-4E9F-A1A8-2A1290B54046}" + ProjectSection(SolutionItems) = preProject + tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj = tests\ComputeSharp.NuGet\ComputeSharp.NuGet.csproj + tests\ComputeSharp.NuGet\nuget.config = tests\ComputeSharp.NuGet\nuget.config + tests\ComputeSharp.NuGet\Program.cs = tests\ComputeSharp.NuGet\Program.cs + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -454,6 +461,7 @@ Global {3ACACF03-6B20-40BA-B8EC-11AC1624D2C9} = {8DCE343F-BA78-4FE1-B562-B57C603A8BAA} {209C95A3-FA53-431B-B688-3299CA6C29D2} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7} {94178D51-0097-4AD2-B3D0-827E40D62F2E} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7} + {CBA545B4-31EF-4E9F-A1A8-2A1290B54046} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC} diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/ComputeSharp.Sample.NuGet.csproj b/tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj similarity index 100% rename from tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/ComputeSharp.Sample.NuGet.csproj rename to tests/ComputeSharp.NuGet/ComputeSharp.NuGet.csproj diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/Program.cs b/tests/ComputeSharp.NuGet/Program.cs similarity index 100% rename from tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/Program.cs rename to tests/ComputeSharp.NuGet/Program.cs diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/nuget.config b/tests/ComputeSharp.NuGet/nuget.config similarity index 81% rename from tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/nuget.config rename to tests/ComputeSharp.NuGet/nuget.config index e1d1b6e5..995d3a62 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/Project/nuget.config +++ b/tests/ComputeSharp.NuGet/nuget.config @@ -3,6 +3,6 @@ - + diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs index c1c9d50a..1cf6ffe2 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/NativeLibrariesResolverTests.cs @@ -19,12 +19,12 @@ public class NativeLibrariesResolverTests { string path = Path.GetDirectoryName(typeof(NativeLibrariesResolverTests).Assembly.Location)!; - while (Path.GetFileName(path) is not "ComputeSharp.Tests.NativeLibrariesResolver") + while (Path.GetFileName(path) is not "tests") { path = Path.GetDirectoryName(path)!; } - SampleProjectDirectory = Path.Combine(path, "Project", "ComputeSharp.Sample.NuGet"); + SampleProjectDirectory = Path.Combine(path, "ComputeSharp.NuGet"); while (Path.GetFileName(path) is not "ComputeSharp") { @@ -42,7 +42,7 @@ public class NativeLibrariesResolverTests } /// - /// Gets the directory of the ComputeSharp.Sample.NuGet project. + /// Gets the directory of the ComputeSharp.NuGet project. /// private static string? SampleProjectDirectory { get; set; } @@ -68,7 +68,7 @@ public class NativeLibrariesResolverTests CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.Sample.NuGet.dll"); + string realtivePathToDll = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.NuGet.dll"); Assert.AreEqual(0, Exec(SampleProjectDirectory!, "dotnet", realtivePathToDll)); } @@ -85,7 +85,7 @@ public class NativeLibrariesResolverTests string pathToDllDirectory = Path.Combine(SampleProjectDirectory!, "bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}"); - Assert.AreEqual(0, Exec(pathToDllDirectory, "dotnet", "ComputeSharp.Sample.NuGet.dll")); + Assert.AreEqual(0, Exec(pathToDllDirectory, "dotnet", "ComputeSharp.NuGet.dll")); } [TestMethod] @@ -98,7 +98,7 @@ public class NativeLibrariesResolverTests CleanSampleProject(configuration, rid); BuildSampleProject(configuration, rid); - string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.Sample.NuGet.exe"); + string relativePathToAppHost = Path.Combine("bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}", "ComputeSharp.NuGet.exe"); Assert.AreEqual(0, Exec(SampleProjectDirectory!, relativePathToAppHost, "")); } @@ -115,7 +115,7 @@ public class NativeLibrariesResolverTests string pathToAppHostDirectory = Path.Combine(SampleProjectDirectory!, "bin", $"{configuration}", "net6.0", $"{ToDirectory(rid)}"); - Assert.AreEqual(0, Exec(pathToAppHostDirectory, "ComputeSharp.Sample.NuGet.exe", "")); + Assert.AreEqual(0, Exec(pathToAppHostDirectory, "ComputeSharp.NuGet.exe", "")); } @@ -134,7 +134,7 @@ public class NativeLibrariesResolverTests Exec(SampleProjectDirectory!, "dotnet", $"publish -c Release -f net6.0 -r win-x64 {ToOption(publishMode)} {ToOption(deploymentMode)} {ToOption(nativeLibsDeploymentMode)} /bl"); - string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", "ComputeSharp.Sample.NuGet.exe"); + string pathToAppHost = Path.Combine("bin", $"Release", "net6.0", "win-x64", "publish", "ComputeSharp.NuGet.exe"); Assert.AreEqual(0, Exec(SampleProjectDirectory!, pathToAppHost, "")); }