From debe76be897b94eb90ddd853c6b3c5146ea4ac98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Tue, 21 Apr 2020 07:49:37 +0200 Subject: [PATCH] SourceLink --- Benchmarking/Benchmark/Benchmark.csproj | 2 +- Benchmarking/CapnpBench.sln | 12 +++-- Benchmarking/CapnpProfile/CapnpProfile.csproj | 4 +- .../EchoServiceCapnp/EchoServiceCapnp.csproj | 2 +- .../EchoServiceGrpc2/EchoServiceGrpc.csproj | 15 +++++++ Benchmarking/EchoServiceGrpc2/Program.cs | 27 ++++++++++++ .../Services/GrpcEchoService.cs | 26 +++++++++++ Benchmarking/EchoServiceGrpc2/Startup.cs | 44 +++++++++++++++++++ .../appsettings.Development.json | 10 +++++ .../EchoServiceGrpc2/appsettings.json | 15 +++++++ Capnp.Net.Runtime/Capnp.Net.Runtime.csproj | 8 +++- 11 files changed, 156 insertions(+), 9 deletions(-) create mode 100644 Benchmarking/EchoServiceGrpc2/EchoServiceGrpc.csproj create mode 100644 Benchmarking/EchoServiceGrpc2/Program.cs create mode 100644 Benchmarking/EchoServiceGrpc2/Services/GrpcEchoService.cs create mode 100644 Benchmarking/EchoServiceGrpc2/Startup.cs create mode 100644 Benchmarking/EchoServiceGrpc2/appsettings.Development.json create mode 100644 Benchmarking/EchoServiceGrpc2/appsettings.json diff --git a/Benchmarking/Benchmark/Benchmark.csproj b/Benchmarking/Benchmark/Benchmark.csproj index 389c446..e40a359 100644 --- a/Benchmarking/Benchmark/Benchmark.csproj +++ b/Benchmarking/Benchmark/Benchmark.csproj @@ -7,7 +7,7 @@ - + diff --git a/Benchmarking/CapnpBench.sln b/Benchmarking/CapnpBench.sln index 061559d..5d814fc 100644 --- a/Benchmarking/CapnpBench.sln +++ b/Benchmarking/CapnpBench.sln @@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29728.190 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoServiceGrpc", "EchoServiceGrpc\EchoServiceGrpc.csproj", "{D59C7B71-3887-426B-A636-2DBDA0549817}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EchoServiceGrpc", "EchoServiceGrpc\EchoServiceGrpc.csproj", "{D59C7B71-3887-426B-A636-2DBDA0549817}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Benchmark\Benchmark.csproj", "{7F7580CA-CCF0-4650-87BF-502D51A8F435}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmark", "Benchmark\Benchmark.csproj", "{7F7580CA-CCF0-4650-87BF-502D51A8F435}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoServiceCapnp", "EchoServiceCapnp\EchoServiceCapnp.csproj", "{309A4A26-F29E-4F49-AB49-76BAE0FD7D62}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EchoServiceCapnp", "EchoServiceCapnp\EchoServiceCapnp.csproj", "{309A4A26-F29E-4F49-AB49-76BAE0FD7D62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EchoServiceGrpc2", "EchoServiceGrpc2\EchoServiceGrpc2.csproj", "{C9CEE2AD-AC6F-4CBD-A83D-2784832C1E37}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {309A4A26-F29E-4F49-AB49-76BAE0FD7D62}.Debug|Any CPU.Build.0 = Debug|Any CPU {309A4A26-F29E-4F49-AB49-76BAE0FD7D62}.Release|Any CPU.ActiveCfg = Release|Any CPU {309A4A26-F29E-4F49-AB49-76BAE0FD7D62}.Release|Any CPU.Build.0 = Release|Any CPU + {C9CEE2AD-AC6F-4CBD-A83D-2784832C1E37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9CEE2AD-AC6F-4CBD-A83D-2784832C1E37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9CEE2AD-AC6F-4CBD-A83D-2784832C1E37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9CEE2AD-AC6F-4CBD-A83D-2784832C1E37}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Benchmarking/CapnpProfile/CapnpProfile.csproj b/Benchmarking/CapnpProfile/CapnpProfile.csproj index 953f368..5db3e9c 100644 --- a/Benchmarking/CapnpProfile/CapnpProfile.csproj +++ b/Benchmarking/CapnpProfile/CapnpProfile.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj b/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj index a35a473..99eff10 100644 --- a/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj +++ b/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj @@ -6,7 +6,7 @@ - + diff --git a/Benchmarking/EchoServiceGrpc2/EchoServiceGrpc.csproj b/Benchmarking/EchoServiceGrpc2/EchoServiceGrpc.csproj new file mode 100644 index 0000000..3d293a8 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/EchoServiceGrpc.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.1 + + + + + + + + + + + diff --git a/Benchmarking/EchoServiceGrpc2/Program.cs b/Benchmarking/EchoServiceGrpc2/Program.cs new file mode 100644 index 0000000..a3d05d6 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/Program.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; + +namespace EchoServiceGrpc2 +{ + public class Program + { + public static void Main(string[] args) + { + CreateHostBuilder(args).Build().Run(); + } + + // Additional configuration is required to successfully run gRPC on macOS. + // For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682 + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }); + } +} diff --git a/Benchmarking/EchoServiceGrpc2/Services/GrpcEchoService.cs b/Benchmarking/EchoServiceGrpc2/Services/GrpcEchoService.cs new file mode 100644 index 0000000..71a7ef9 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/Services/GrpcEchoService.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Grpc.Core; +using Microsoft.Extensions.Logging; + +namespace EchoService +{ + public class GrpcEchoService : Echoer.EchoerBase + { + private readonly ILogger _logger; + public GrpcEchoService(ILogger logger) + { + _logger = logger; + } + + public override Task Echo(EchoRequest request, ServerCallContext context) + { + return Task.FromResult(new EchoReply + { + Payload = request.Payload + }); + } + } +} diff --git a/Benchmarking/EchoServiceGrpc2/Startup.cs b/Benchmarking/EchoServiceGrpc2/Startup.cs new file mode 100644 index 0000000..3679177 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/Startup.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using EchoService; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EchoServiceGrpc2 +{ + public class Startup + { + // This method gets called by the runtime. Use this method to add services to the container. + // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 + public void ConfigureServices(IServiceCollection services) + { + services.AddGrpc(); + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseRouting(); + + app.UseEndpoints(endpoints => + { + endpoints.MapGrpcService(); + + endpoints.MapGet("/", async context => + { + await context.Response.WriteAsync("Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909"); + }); + }); + } + } +} diff --git a/Benchmarking/EchoServiceGrpc2/appsettings.Development.json b/Benchmarking/EchoServiceGrpc2/appsettings.Development.json new file mode 100644 index 0000000..fe20c40 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Grpc": "Information", + "Microsoft": "Information" + } + } +} diff --git a/Benchmarking/EchoServiceGrpc2/appsettings.json b/Benchmarking/EchoServiceGrpc2/appsettings.json new file mode 100644 index 0000000..3110458 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc2/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Warning" + } + }, + "AllowedHosts": "*", + "Kestrel": { + "EndpointDefaults": { + "Protocols": "Http2" + } + } +} diff --git a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj index b7675b9..4773820 100644 --- a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj +++ b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj @@ -22,8 +22,12 @@ capnp "Cap'n Proto" RPC serialization cerealization Debug;Release true + true + true + true + snupkg - + TRACE;DEBUG @@ -39,6 +43,6 @@ + -