From c0092678ab3d1253fd0417983ec4ce5c9b95b257 Mon Sep 17 00:00:00 2001 From: Cameron Aavik Date: Thu, 5 Oct 2023 09:53:40 +1000 Subject: [PATCH 1/3] WIP removing entry point --- NuGet.Config | 1 + .../BenchmarkDotNet.Samples.csproj | 7 +++++-- samples/BenchmarkDotNet.Samples/Program.cs | 9 --------- src/BenchmarkDotNet/BenchmarkDotNet.csproj | 6 ++++++ src/BenchmarkDotNet/build/BenchmarkDotNet.cs | 7 +++++++ src/BenchmarkDotNet/build/BenchmarkDotNet.props | 9 +++++++++ 6 files changed, 28 insertions(+), 11 deletions(-) delete mode 100644 samples/BenchmarkDotNet.Samples/Program.cs create mode 100644 src/BenchmarkDotNet/build/BenchmarkDotNet.cs create mode 100644 src/BenchmarkDotNet/build/BenchmarkDotNet.props diff --git a/NuGet.Config b/NuGet.Config index 2b16f5257e..4f0049df13 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -7,6 +7,7 @@ + diff --git a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj index 180148454a..43501418f2 100644 --- a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj +++ b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj @@ -19,10 +19,13 @@ + + + - + diff --git a/samples/BenchmarkDotNet.Samples/Program.cs b/samples/BenchmarkDotNet.Samples/Program.cs deleted file mode 100644 index 71daa668ba..0000000000 --- a/samples/BenchmarkDotNet.Samples/Program.cs +++ /dev/null @@ -1,9 +0,0 @@ -using BenchmarkDotNet.Running; - -namespace BenchmarkDotNet.Samples -{ - public class Program - { - public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); - } -} \ No newline at end of file diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj index 50e6733592..51c5ff13df 100644 --- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj +++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj @@ -56,4 +56,10 @@ + + + + + + diff --git a/src/BenchmarkDotNet/build/BenchmarkDotNet.cs b/src/BenchmarkDotNet/build/BenchmarkDotNet.cs new file mode 100644 index 0000000000..16390a857b --- /dev/null +++ b/src/BenchmarkDotNet/build/BenchmarkDotNet.cs @@ -0,0 +1,7 @@ +using BenchmarkDotNet.Running; +using System.Reflection; + +public class Program +{ + public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(Assembly.GetEntryAssembly()).Run(args); +} diff --git a/src/BenchmarkDotNet/build/BenchmarkDotNet.props b/src/BenchmarkDotNet/build/BenchmarkDotNet.props new file mode 100644 index 0000000000..4cad8d1472 --- /dev/null +++ b/src/BenchmarkDotNet/build/BenchmarkDotNet.props @@ -0,0 +1,9 @@ + + + + false + + + + + \ No newline at end of file From 921b980eeb69294e684a2f0b0e86f7c9a89872c8 Mon Sep 17 00:00:00 2001 From: Cameron Aavik <99771732+caaavik-msft@users.noreply.github.com> Date: Sat, 7 Oct 2023 05:52:48 +1000 Subject: [PATCH 2/3] Finish entry point generation --- .../BenchmarkDotNet.Samples.csproj | 7 ++----- samples/BenchmarkDotNet.Samples/Program.cs | 9 +++++++++ src/BenchmarkDotNet/BenchmarkDotNet.csproj | 6 +++--- src/BenchmarkDotNet/Package/BenchmarkDotNet.props | 12 ++++++++++++ .../BenchmarkDotNet.cs => Package/EntryPoint.cs} | 2 +- src/BenchmarkDotNet/Package/EntryPoint.fs | 8 ++++++++ src/BenchmarkDotNet/Package/EntryPoint.vb | 10 ++++++++++ src/BenchmarkDotNet/build/BenchmarkDotNet.props | 9 --------- 8 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 samples/BenchmarkDotNet.Samples/Program.cs create mode 100644 src/BenchmarkDotNet/Package/BenchmarkDotNet.props rename src/BenchmarkDotNet/{build/BenchmarkDotNet.cs => Package/EntryPoint.cs} (80%) create mode 100644 src/BenchmarkDotNet/Package/EntryPoint.fs create mode 100644 src/BenchmarkDotNet/Package/EntryPoint.vb delete mode 100644 src/BenchmarkDotNet/build/BenchmarkDotNet.props diff --git a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj index 43501418f2..180148454a 100644 --- a/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj +++ b/samples/BenchmarkDotNet.Samples/BenchmarkDotNet.Samples.csproj @@ -19,13 +19,10 @@ - - - - + diff --git a/samples/BenchmarkDotNet.Samples/Program.cs b/samples/BenchmarkDotNet.Samples/Program.cs new file mode 100644 index 0000000000..c3e908371b --- /dev/null +++ b/samples/BenchmarkDotNet.Samples/Program.cs @@ -0,0 +1,9 @@ +using BenchmarkDotNet.Running; + +namespace BenchmarkDotNet.Samples +{ + public class Program + { + public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); + } +} \ No newline at end of file diff --git a/src/BenchmarkDotNet/BenchmarkDotNet.csproj b/src/BenchmarkDotNet/BenchmarkDotNet.csproj index 51c5ff13df..e9c26e0698 100644 --- a/src/BenchmarkDotNet/BenchmarkDotNet.csproj +++ b/src/BenchmarkDotNet/BenchmarkDotNet.csproj @@ -58,8 +58,8 @@ - - - + + + diff --git a/src/BenchmarkDotNet/Package/BenchmarkDotNet.props b/src/BenchmarkDotNet/Package/BenchmarkDotNet.props new file mode 100644 index 0000000000..bb7992372d --- /dev/null +++ b/src/BenchmarkDotNet/Package/BenchmarkDotNet.props @@ -0,0 +1,12 @@ + + + + false + $(MSBuildThisFileDirectory)..\entrypoints\ + + + + + + + \ No newline at end of file diff --git a/src/BenchmarkDotNet/build/BenchmarkDotNet.cs b/src/BenchmarkDotNet/Package/EntryPoint.cs similarity index 80% rename from src/BenchmarkDotNet/build/BenchmarkDotNet.cs rename to src/BenchmarkDotNet/Package/EntryPoint.cs index 16390a857b..37ab42530d 100644 --- a/src/BenchmarkDotNet/build/BenchmarkDotNet.cs +++ b/src/BenchmarkDotNet/Package/EntryPoint.cs @@ -1,7 +1,7 @@ using BenchmarkDotNet.Running; using System.Reflection; -public class Program +public class __AutoGeneratedEntryPointClass { public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(Assembly.GetEntryAssembly()).Run(args); } diff --git a/src/BenchmarkDotNet/Package/EntryPoint.fs b/src/BenchmarkDotNet/Package/EntryPoint.fs new file mode 100644 index 0000000000..f3546c794c --- /dev/null +++ b/src/BenchmarkDotNet/Package/EntryPoint.fs @@ -0,0 +1,8 @@ +module __AutoGeneratedEntryPointClass +open System.Reflection; +open BenchmarkDotNet.Running + +[] +let main argv = + BenchmarkSwitcher.FromAssembly(Assembly.GetEntryAssembly()).Run(argv) |> ignore + 0 // return an integer exit code \ No newline at end of file diff --git a/src/BenchmarkDotNet/Package/EntryPoint.vb b/src/BenchmarkDotNet/Package/EntryPoint.vb new file mode 100644 index 0000000000..9875ddda16 --- /dev/null +++ b/src/BenchmarkDotNet/Package/EntryPoint.vb @@ -0,0 +1,10 @@ +Imports System.Reflection +Imports BenchmarkDotNet.Running + +Namespace Global + Module __AutoGeneratedEntryPointClass + Sub Main(args As String()) + Dim summary = BenchmarkSwitcher.FromAssembly(Assembly.GetEntryAssembly()).Run(args) + End Sub + End Module +End Namespace diff --git a/src/BenchmarkDotNet/build/BenchmarkDotNet.props b/src/BenchmarkDotNet/build/BenchmarkDotNet.props deleted file mode 100644 index 4cad8d1472..0000000000 --- a/src/BenchmarkDotNet/build/BenchmarkDotNet.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - false - - - - - \ No newline at end of file From f6d39d2cdbc38cbf13bb891ab981c66e0a4943fb Mon Sep 17 00:00:00 2001 From: Cameron Aavik <99771732+caaavik-msft@users.noreply.github.com> Date: Sat, 7 Oct 2023 06:46:37 +1000 Subject: [PATCH 3/3] Undo nuget config change --- NuGet.Config | 1 - samples/BenchmarkDotNet.Samples/Program.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/NuGet.Config b/NuGet.Config index 4f0049df13..2b16f5257e 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -7,7 +7,6 @@ - diff --git a/samples/BenchmarkDotNet.Samples/Program.cs b/samples/BenchmarkDotNet.Samples/Program.cs index c3e908371b..71daa668ba 100644 --- a/samples/BenchmarkDotNet.Samples/Program.cs +++ b/samples/BenchmarkDotNet.Samples/Program.cs @@ -1,4 +1,4 @@ -using BenchmarkDotNet.Running; +using BenchmarkDotNet.Running; namespace BenchmarkDotNet.Samples {