From b0fdf30525c8572db3aaffb2d02345d89072037b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Mon, 30 Dec 2019 19:27:11 +0100 Subject: [PATCH 01/45] Enabled .NET Core CLI tool build --- appveyor.yml | 5 ++++- capnpc-csharp/capnpc-csharp.csproj | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index bfbe4fb..d375d89 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,10 @@ artifacts: - path: chocolatey\install\capnpc-csharp-win-x86.$(appveyor_build_version).nupkg name: capnpc-csharp-win-x86 type: NuGetPackage - - path: chocolatey\install\capnpc-csharp.$(appveyor_build_version).nupkg +# - path: chocolatey\install\capnpc-csharp.$(appveyor_build_version).nupkg +# name: capnpc-csharp +# type: NuGetPackage + - path: capnpc-csharp\nupkg\capnpc-csharp.$(appveyor_build_version).nupkg name: capnpc-csharp type: NuGetPackage clone_depth: 1 diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj index f5088f0..50f7dc4 100644 --- a/capnpc-csharp/capnpc-csharp.csproj +++ b/capnpc-csharp/capnpc-csharp.csproj @@ -5,7 +5,10 @@ netcoreapp2.1 CapnpC 7.1 - false + true + true + capnpc-csharp + ./nupkg/capnpc-csharp MIT Christian Köllner and contributors Cap'n Proto C# code generator backend From a2fc5c01f7f192e17e37e27a4d3e19bf8c6d9b5e Mon Sep 17 00:00:00 2001 From: c80k Date: Mon, 30 Dec 2019 19:44:07 +0100 Subject: [PATCH 02/45] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c9ecef5..0abcdcc 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,9 @@ choco install capnpc-csharp-win-x86 Both versions will also download and install the [Cap'n Proto tool set Chocolatey package](https://www.chocolatey.org/packages/capnproto). Note that the author does not maintain this package and has no influence on its contents. +*Announcement: There is currently an experimental branch for packaging the code generator back end as .NET Core CLI tool. If this approach turns out to be viable, it will probably be superior to the Chocolatey deployment. In that case, the CLI tool capnpc-csharp will be deployed on NuGet.org and the former Chocolatey package will be deprecated. capnpc-csharp-win-x86 will probably be kept (and also maintained).* + + ### Code generator back end: Other OSes Currently, you are on yourself. Compile the `capnpc-csharp` VS project and install the resulting .NET application manually on your system. This should not be that complicated, see also the [Wiki](https://github.com/c80k/capnproto-dotnetcore/wiki). It would be great to support other package managers, especially [APT](https://wiki.debian.org/Apt). Consider contributing? Author would be happy! From d2f3405cec817e3d16b3f0a8d8b35b6f2743d438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Tue, 31 Dec 2019 00:24:28 +0100 Subject: [PATCH 03/45] - SemVer fix - deprecated choco capnp-csharp - include CLI capnpc-csharp in test --- appveyor.yml | 17 ++++++++------- chocolatey/capnpc-csharp/capnpc-csharp.nuspec | 21 +++++++------------ scripts/capnpc-csharp-pack.ps1 | 3 ++- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d375d89..00a61e1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '1.3.{build}' +version: '1.3.0-alpha' image: Visual Studio 2019 # branches: # only: @@ -51,22 +51,25 @@ artifacts: - path: chocolatey\install\capnpc-csharp-win-x86.$(appveyor_build_version).nupkg name: capnpc-csharp-win-x86 type: NuGetPackage -# - path: chocolatey\install\capnpc-csharp.$(appveyor_build_version).nupkg -# name: capnpc-csharp -# type: NuGetPackage + - path: chocolatey\install\capnpc-csharp.$(appveyor_build_version)-deprecated.nupkg + name: capnpc-csharp-deprecated + type: NuGetPackage - path: capnpc-csharp\nupkg\capnpc-csharp.$(appveyor_build_version).nupkg name: capnpc-csharp type: NuGetPackage clone_depth: 1 test_script: - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll - - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install - - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y +# - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install +# - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y + - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp + - cmd: dotnet tool install --global --add-source ./nupkg capnpc-csharp - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - cmd: compile-test - cmd: cd %APPVEYOR_BUILD_FOLDER% - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll - - cmd: choco uninstall capnpc-csharp -y +# - cmd: choco uninstall capnpc-csharp -y + - cmd: dotnet tool install --global capnpc-csharp - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - cmd: notinstalled-test - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install diff --git a/chocolatey/capnpc-csharp/capnpc-csharp.nuspec b/chocolatey/capnpc-csharp/capnpc-csharp.nuspec index 801c842..8b0b66c 100644 --- a/chocolatey/capnpc-csharp/capnpc-csharp.nuspec +++ b/chocolatey/capnpc-csharp/capnpc-csharp.nuspec @@ -10,8 +10,11 @@ https://github.com/c80k/capnproto-dotnetcore/blob/master/LICENSE https://github.com/c80k/capnproto-dotnetcore - capnpc-csharp (Install) - Cap'n Proto C# code generator backend, portable .NET Core 2.1 + [Deprecated] capnpc-csharp (Install) + Cap'n Proto C# code generator backend, portable .NET Core 2.1 + This package is deprecated now. It was converted to a .NET Core CLI tool which is now hosted here: https://www.nuget.org/packages/capnpc-csharp + To install, type: dotnet tool install -g capnpc-csharp + Cap'n Proto C# code generator backend. This is the portable variant which depends on .NET Core 2.1 (as opposed to capnpc-csharp-win-x86) Christian Köllner and contributors https://github.com/c80k/capnproto-dotnetcore @@ -20,17 +23,7 @@ capnp capnpc RPC serialization cerealization https://github.com/c80k/capnproto-dotnetcore/releases/tag/v$version$ - - - - + - - - - - - - - + \ No newline at end of file diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index 79935d5..360a386 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -10,7 +10,7 @@ $installDir = "$chocoDir\install" dotnet build -c Release "$scriptDir\..\Capnp.Net.sln" dotnet publish -c Release -r win-x86 --self-contained -o "$chocoDir\$id_win_x86\bin" "$csprojDir\$csprojFile" -dotnet publish -c Release -o "$chocoDir\$id\bin" "$csprojDir\$csprojFile" +# dotnet publish -c Release -o "$chocoDir\$id\bin" "$csprojDir\$csprojFile" If(!(test-path $installDir)) { @@ -21,3 +21,4 @@ Copy-Item "$scriptDir\..\LICENSE" -Destination "$chocoDir\LICENSE.txt" choco pack "$chocoDir\$id\$id.nuspec" --version $version --outputdirectory $installDir choco pack "$chocoDir\$id_win_x86\$id_win_x86.nuspec" --version $version --outputdirectory $installDir +Rename-Item -Path "$installDir\$id.nupkg" -NewName "$installDir\$id-deprecated.nupkg" \ No newline at end of file From 09c5e31f34d1529cfa64b4482684b7fd6ab12353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Tue, 31 Dec 2019 00:51:23 +0100 Subject: [PATCH 04/45] version fix --- appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 00a61e1..7892b2f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '1.3.0-alpha' +version: '1.3.0' image: Visual Studio 2019 # branches: # only: @@ -62,6 +62,7 @@ test_script: - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll # - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install # - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y + - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - cmd: dotnet tool install --global --add-source ./nupkg capnpc-csharp - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test @@ -69,7 +70,7 @@ test_script: - cmd: cd %APPVEYOR_BUILD_FOLDER% - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll # - cmd: choco uninstall capnpc-csharp -y - - cmd: dotnet tool install --global capnpc-csharp + - cmd: dotnet tool uninstall --global capnpc-csharp - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - cmd: notinstalled-test - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install From f4130ab82803b9d3d13e427853a53c16b11ad8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:12:19 +0100 Subject: [PATCH 05/45] semver fix --- appveyor.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7892b2f..3b7237e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,6 @@ -version: '1.3.0' +environment: + semver: "1.3.0" +version: '{semver}+{build}' image: Visual Studio 2019 # branches: # only: @@ -17,10 +19,10 @@ dotnet_csproj: patch: true file: '**\*.csproj;**\*.props;**\*.fsproj;**\*.xml' version: '{version}' - package_version: '{version}' + package_version: '{semver}' assembly_version: '{version}' file_version: '{version}' - informational_version: '{version}' + informational_version: '{semver}' before_build: - cmd: dotnet --version - cmd: msbuild -ver From 118fb81ec46cc1a4c541d0bc4c12f09ce44b27ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:13:30 +0100 Subject: [PATCH 06/45] appveyor fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3b7237e..c12161f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ environment: semver: "1.3.0" -version: '{semver}+{build}' +version: '$(semver)+{build}' image: Visual Studio 2019 # branches: # only: From 9e4171e3e334fbcef0cc096a10e47ccae075364a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:38:16 +0100 Subject: [PATCH 07/45] semver + appveyor fix --- appveyor.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c12161f..3c83ff6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,11 @@ environment: - semver: "1.3.0" -version: '$(semver)+{build}' + major: 1 + minor: 3 + patch: 0 + semver: '$(major).$(minor).$(patch)' + fullsemver: '$(semver)+{build}' + msasmver: '$(major).$(minor).{build}.$(patch)' +version: '$(fullsemver)' image: Visual Studio 2019 # branches: # only: @@ -18,11 +23,11 @@ install: dotnet_csproj: patch: true file: '**\*.csproj;**\*.props;**\*.fsproj;**\*.xml' - version: '{version}' - package_version: '{semver}' - assembly_version: '{version}' - file_version: '{version}' - informational_version: '{semver}' + version: '$(semver)' + package_version: '$(semver)' + assembly_version: '$(msasmver)' + file_version: '$(msasmver)' + informational_version: '$(fullsemver)' before_build: - cmd: dotnet --version - cmd: msbuild -ver From 279b8ff1dc273288ad8f99145bf6ce60d2455242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:51:55 +0100 Subject: [PATCH 08/45] appveyor fix --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3c83ff6..5e47e92 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,9 +2,10 @@ environment: major: 1 minor: 3 patch: 0 - semver: '$(major).$(minor).$(patch)' - fullsemver: '$(semver)+{build}' - msasmver: '$(major).$(minor).{build}.$(patch)' +init: + - cmd: set semver='%major%.%minor%.%patch%' + - cmd: set fullsemver='%semver%+{build}' + - cmd: set msasmver='%major%.%minor%.{build}.%patch%' version: '$(fullsemver)' image: Visual Studio 2019 # branches: From 72e638803a426405413a4c15e23319a0f3a927d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:52:53 +0100 Subject: [PATCH 09/45] appveyor fix --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5e47e92..0e6a805 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,6 +6,8 @@ init: - cmd: set semver='%major%.%minor%.%patch%' - cmd: set fullsemver='%semver%+{build}' - cmd: set msasmver='%major%.%minor%.{build}.%patch%' + # Good practise, because Windows line endings are different from Unix/Linux ones + - cmd: git config --global core.autocrlf true version: '$(fullsemver)' image: Visual Studio 2019 # branches: @@ -13,9 +15,6 @@ image: Visual Studio 2019 # - master cache: - c:\Tools\vcpkg\installed -init: - # Good practise, because Windows line endings are different from Unix/Linux ones - - cmd: git config --global core.autocrlf true install: - cd c:\tools\vcpkg - vcpkg integrate install From 757a35b399ff96c0b3a5aeafa9cf811bf54c2750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:57:30 +0100 Subject: [PATCH 10/45] appveyor fix --- appveyor.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0e6a805..0b5cd91 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,13 +2,7 @@ environment: major: 1 minor: 3 patch: 0 -init: - - cmd: set semver='%major%.%minor%.%patch%' - - cmd: set fullsemver='%semver%+{build}' - - cmd: set msasmver='%major%.%minor%.{build}.%patch%' - # Good practise, because Windows line endings are different from Unix/Linux ones - - cmd: git config --global core.autocrlf true -version: '$(fullsemver)' +version: '$(major).$(minor).$(patch)+{build}' image: Visual Studio 2019 # branches: # only: @@ -20,6 +14,11 @@ install: - vcpkg integrate install - vcpkg install capnproto - cd %APPVEYOR_BUILD_FOLDER% +init: + - cmd: set semver='%major%.%minor%.%patch%' + - cmd: set msasmver='%major%.%minor%.{build}.%patch%' + # Good practise, because Windows line endings are different from Unix/Linux ones + - cmd: git config --global core.autocrlf true dotnet_csproj: patch: true file: '**\*.csproj;**\*.props;**\*.fsproj;**\*.xml' @@ -27,7 +26,7 @@ dotnet_csproj: package_version: '$(semver)' assembly_version: '$(msasmver)' file_version: '$(msasmver)' - informational_version: '$(fullsemver)' + informational_version: '{version}' before_build: - cmd: dotnet --version - cmd: msbuild -ver From 3620beae12f9d29b747115366da0c57c67a1c697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 17:59:02 +0100 Subject: [PATCH 11/45] appveyor fix --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0b5cd91..c88dd59 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,8 +15,8 @@ install: - vcpkg install capnproto - cd %APPVEYOR_BUILD_FOLDER% init: - - cmd: set semver='%major%.%minor%.%patch%' - - cmd: set msasmver='%major%.%minor%.{build}.%patch%' + - cmd: set semver=%major%.%minor%.%patch% + - cmd: set msasmver=%major%.%minor%.%build%.%patch% # Good practise, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true dotnet_csproj: From cedd033c42c88f857b35c726e2f3d006b081aa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 18:04:20 +0100 Subject: [PATCH 12/45] appveyor fix --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index c88dd59..4837b01 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,8 @@ install: init: - cmd: set semver=%major%.%minor%.%patch% - cmd: set msasmver=%major%.%minor%.%build%.%patch% + - cmd: echo %semver% + - cmd: echo %msasmver% # Good practise, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true dotnet_csproj: From 32006e242772d3d42fcd8204705480ef193a0f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 18:05:30 +0100 Subject: [PATCH 13/45] appveyor fix --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 4837b01..78c13e7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,7 @@ environment: major: 1 minor: 3 patch: 0 + build: {build} version: '$(major).$(minor).$(patch)+{build}' image: Visual Studio 2019 # branches: From 60bc36fedd0711f4cdff31e96c7ddf8fc1025e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 18:06:39 +0100 Subject: [PATCH 14/45] appveyor fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 78c13e7..c5249ec 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ environment: major: 1 minor: 3 patch: 0 - build: {build} + build: '{build}' version: '$(major).$(minor).$(patch)+{build}' image: Visual Studio 2019 # branches: From b948b841113624a9fa24764daeb83cdbe2fe10c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 18:10:52 +0100 Subject: [PATCH 15/45] appveyor fix --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c5249ec..6e11ddc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,6 @@ environment: major: 1 minor: 3 patch: 0 - build: '{build}' version: '$(major).$(minor).$(patch)+{build}' image: Visual Studio 2019 # branches: @@ -17,7 +16,7 @@ install: - cd %APPVEYOR_BUILD_FOLDER% init: - cmd: set semver=%major%.%minor%.%patch% - - cmd: set msasmver=%major%.%minor%.%build%.%patch% + - cmd: set msasmver=%major%.%minor%.%APPVEYOR_BUILD_NUMBER%.%patch% - cmd: echo %semver% - cmd: echo %msasmver% # Good practise, because Windows line endings are different from Unix/Linux ones From 766e823aaba20b456e56104b6fb4f1c7b74da4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 19:37:19 +0100 Subject: [PATCH 16/45] versioning --- Capnp.Net.Runtime/Capnp.Net.Runtime.csproj | 2 ++ CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj | 3 +++ appveyor.yml | 10 +++++----- capnpc-csharp/capnpc-csharp.csproj | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj index 2d6ac0e..756bd88 100644 --- a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj +++ b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj @@ -19,6 +19,8 @@ Git capnp "Cap'n Proto" RPC serialization cerealization 1.3-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) + 1.3.0.0 + 1.3.0.0 Debug;Release true diff --git a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj index e752fdf..2179b56 100644 --- a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj +++ b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj @@ -3,6 +3,9 @@ netstandard2.0;netcoreapp2.1 Debug;Release + 1.3.0.0 + 1.3.0.0 + 1.3.0.0 diff --git a/appveyor.yml b/appveyor.yml index 6e11ddc..780c080 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,19 +50,19 @@ build_script: after_build: # For once the build has completed artifacts: - - path: bin\Release\Capnp.Net.Runtime.$(appveyor_build_version).nupkg + - path: bin\Release\Capnp.Net.Runtime.$(semver).nupkg name: Capnp.Net.Runtime type: NuGetPackage - - path: bin\Release\CapnpC.CSharp.MsBuild.Generation.$(appveyor_build_version).nupkg + - path: bin\Release\CapnpC.CSharp.MsBuild.Generation.$(semver).nupkg name: CapnpC.CSharp.MsBuild.Generation type: NuGetPackage - - path: chocolatey\install\capnpc-csharp-win-x86.$(appveyor_build_version).nupkg + - path: chocolatey\install\capnpc-csharp-win-x86.$(semver).nupkg name: capnpc-csharp-win-x86 type: NuGetPackage - - path: chocolatey\install\capnpc-csharp.$(appveyor_build_version)-deprecated.nupkg + - path: chocolatey\install\capnpc-csharp.$(semver)-deprecated.nupkg name: capnpc-csharp-deprecated type: NuGetPackage - - path: capnpc-csharp\nupkg\capnpc-csharp.$(appveyor_build_version).nupkg + - path: capnpc-csharp\nupkg\capnpc-csharp.$(semver).nupkg name: capnpc-csharp type: NuGetPackage clone_depth: 1 diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj index 50f7dc4..0ada204 100644 --- a/capnpc-csharp/capnpc-csharp.csproj +++ b/capnpc-csharp/capnpc-csharp.csproj @@ -17,6 +17,8 @@ Git capnp capnpc RPC serialization cerealization 1.3.0 + 1.3.0.0 + 1.3.0.0 Debug;Release From 72f85fb380d4e5d4f6c8a14efd07aa13cf0b2273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 20:21:29 +0100 Subject: [PATCH 17/45] versioning fix --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 780c080..3e800d2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,19 +50,19 @@ build_script: after_build: # For once the build has completed artifacts: - - path: bin\Release\Capnp.Net.Runtime.$(semver).nupkg + - path: bin\Release\Capnp.Net.Runtime.*.nupkg name: Capnp.Net.Runtime type: NuGetPackage - - path: bin\Release\CapnpC.CSharp.MsBuild.Generation.$(semver).nupkg + - path: bin\Release\CapnpC.CSharp.MsBuild.Generation.*.nupkg name: CapnpC.CSharp.MsBuild.Generation type: NuGetPackage - - path: chocolatey\install\capnpc-csharp-win-x86.$(semver).nupkg + - path: chocolatey\install\capnpc-csharp-win-x86.*.nupkg name: capnpc-csharp-win-x86 type: NuGetPackage - - path: chocolatey\install\capnpc-csharp.$(semver)-deprecated.nupkg + - path: chocolatey\install\capnpc-csharp.*-deprecated.nupkg name: capnpc-csharp-deprecated type: NuGetPackage - - path: capnpc-csharp\nupkg\capnpc-csharp.$(semver).nupkg + - path: capnpc-csharp\nupkg\capnpc-csharp.*.nupkg name: capnpc-csharp type: NuGetPackage clone_depth: 1 From 0a04aa886cb4bb979132160213d375a7ab355cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 20:40:07 +0100 Subject: [PATCH 18/45] versioning fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3e800d2..8abbd91 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,7 @@ build_script: - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Release" - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Debug" - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Release" - - ps: scripts\capnpc-csharp-pack.ps1 $env:appveyor_build_version + - ps: scripts\capnpc-csharp-pack.ps1 $env:semver after_build: # For once the build has completed artifacts: From 37f442186122214c320c01088638913a8a199f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 20:49:30 +0100 Subject: [PATCH 19/45] choco packaging fix --- chocolatey/capnpc-csharp/capnpc-csharp.nuspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chocolatey/capnpc-csharp/capnpc-csharp.nuspec b/chocolatey/capnpc-csharp/capnpc-csharp.nuspec index 8b0b66c..7a819d2 100644 --- a/chocolatey/capnpc-csharp/capnpc-csharp.nuspec +++ b/chocolatey/capnpc-csharp/capnpc-csharp.nuspec @@ -23,7 +23,9 @@ capnp capnpc RPC serialization cerealization https://github.com/c80k/capnproto-dotnetcore/releases/tag/v$version$ - + + + \ No newline at end of file From 16a9240df60c20eb4fc3adb1139618bdcde140a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 20:53:17 +0100 Subject: [PATCH 20/45] choco packaging fix --- scripts/capnpc-csharp-pack.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index 360a386..0bb46b1 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -21,4 +21,4 @@ Copy-Item "$scriptDir\..\LICENSE" -Destination "$chocoDir\LICENSE.txt" choco pack "$chocoDir\$id\$id.nuspec" --version $version --outputdirectory $installDir choco pack "$chocoDir\$id_win_x86\$id_win_x86.nuspec" --version $version --outputdirectory $installDir -Rename-Item -Path "$installDir\$id.nupkg" -NewName "$installDir\$id-deprecated.nupkg" \ No newline at end of file +Rename-Item -Path "$installDir\$id.$version.nupkg" -NewName "$installDir\$id.$version-deprecated.nupkg" \ No newline at end of file From 2c1398906c235da667f202ee11401d5460ea3e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 20:59:02 +0100 Subject: [PATCH 21/45] choco packaging fix --- scripts/capnpc-csharp-pack.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index 0bb46b1..6d5a34f 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -21,4 +21,4 @@ Copy-Item "$scriptDir\..\LICENSE" -Destination "$chocoDir\LICENSE.txt" choco pack "$chocoDir\$id\$id.nuspec" --version $version --outputdirectory $installDir choco pack "$chocoDir\$id_win_x86\$id_win_x86.nuspec" --version $version --outputdirectory $installDir -Rename-Item -Path "$installDir\$id.$version.nupkg" -NewName "$installDir\$id.$version-deprecated.nupkg" \ No newline at end of file +Rename-Item -Path "$installDir\$id.$version.nupkg" -NewName "$id.$version-deprecated.nupkg" \ No newline at end of file From 2ae5ad9d783b15c5bea9b7e1cbc68ddf66c6e054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 21:34:17 +0100 Subject: [PATCH 22/45] deployment fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8abbd91..c35cb5e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -62,7 +62,7 @@ artifacts: - path: chocolatey\install\capnpc-csharp.*-deprecated.nupkg name: capnpc-csharp-deprecated type: NuGetPackage - - path: capnpc-csharp\nupkg\capnpc-csharp.*.nupkg + - path: capnpc-csharp\nupkg\*.nupkg name: capnpc-csharp type: NuGetPackage clone_depth: 1 From fb949e7ae525edf8a03385045dd795ffcede4870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 22:13:11 +0100 Subject: [PATCH 23/45] deployment fix --- capnpc-csharp/capnpc-csharp.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj index 0ada204..3834a2b 100644 --- a/capnpc-csharp/capnpc-csharp.csproj +++ b/capnpc-csharp/capnpc-csharp.csproj @@ -8,7 +8,7 @@ true true capnpc-csharp - ./nupkg/capnpc-csharp + ./nupkg MIT Christian Köllner and contributors Cap'n Proto C# code generator backend From 5d94d1f8d3bd3415192408d0d82bcfaf21f23b32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 22:38:33 +0100 Subject: [PATCH 24/45] introducing nbgv --- Directory.Build.props | 9 +++++++++ version.json | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Directory.Build.props create mode 100644 version.json diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..46af06b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,9 @@ + + + + + 3.0.28 + all + + + \ No newline at end of file diff --git a/version.json b/version.json new file mode 100644 index 0000000..436aeab --- /dev/null +++ b/version.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.0-beta", + "publicReleaseRefSpec": [ + "^refs/heads/master$", + "^refs/heads/v\\d+(?:\\.\\d+)?$" + ], + "cloudBuild": { + "buildNumber": { + "enabled": true + } + } +} \ No newline at end of file From 033d42f91d6e01687315d387710dc207da1abc6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 22:39:00 +0100 Subject: [PATCH 25/45] adaptions for nbgv --- Capnp.Net.Runtime/Capnp.Net.Runtime.csproj | 3 --- .../CapnpC.CSharp.Generator.csproj | 3 --- .../CapnpC.CSharp.MsBuild.Generation.csproj | 3 --- appveyor.yml | 23 ++++--------------- capnpc-csharp/capnpc-csharp.csproj | 3 --- scripts/capnpc-csharp-pack.ps1 | 2 +- version.json | 2 +- 7 files changed, 6 insertions(+), 33 deletions(-) diff --git a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj index 756bd88..6b5d624 100644 --- a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj +++ b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj @@ -18,9 +18,6 @@ MIT Git capnp "Cap'n Proto" RPC serialization cerealization - 1.3-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) - 1.3.0.0 - 1.3.0.0 Debug;Release true diff --git a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj index 2179b56..e752fdf 100644 --- a/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj +++ b/CapnpC.CSharp.Generator/CapnpC.CSharp.Generator.csproj @@ -3,9 +3,6 @@ netstandard2.0;netcoreapp2.1 Debug;Release - 1.3.0.0 - 1.3.0.0 - 1.3.0.0 diff --git a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj index c2aa0e7..44f3dec 100644 --- a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj +++ b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj @@ -9,9 +9,6 @@ true true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 1.3.0.0 - 1.3.0.0 - 1.3-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) $(MSBuildThisFileDirectory)CapnpC.CSharp.MsBuild.Generation.nuspec version=$(Version);configuration=$(Configuration) diff --git a/appveyor.yml b/appveyor.yml index c35cb5e..3752b3e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,3 @@ -environment: - major: 1 - minor: 3 - patch: 0 -version: '$(major).$(minor).$(patch)+{build}' image: Visual Studio 2019 # branches: # only: @@ -14,21 +9,11 @@ install: - vcpkg integrate install - vcpkg install capnproto - cd %APPVEYOR_BUILD_FOLDER% + - dotnet tool install -g . nbgv init: - - cmd: set semver=%major%.%minor%.%patch% - - cmd: set msasmver=%major%.%minor%.%APPVEYOR_BUILD_NUMBER%.%patch% - - cmd: echo %semver% - - cmd: echo %msasmver% # Good practise, because Windows line endings are different from Unix/Linux ones + - cmd: nbgv cloud - cmd: git config --global core.autocrlf true -dotnet_csproj: - patch: true - file: '**\*.csproj;**\*.props;**\*.fsproj;**\*.xml' - version: '$(semver)' - package_version: '$(semver)' - assembly_version: '$(msasmver)' - file_version: '$(msasmver)' - informational_version: '{version}' before_build: - cmd: dotnet --version - cmd: msbuild -ver @@ -43,10 +28,10 @@ before_build: - cmd: dotnet restore ./capnpc-csharp/capnpc-csharp.csproj --verbosity m build_script: - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Debug" - - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Release" + - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Release" /p:PublicRelease=true - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Debug" - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Release" - - ps: scripts\capnpc-csharp-pack.ps1 $env:semver + - ps: scripts\capnpc-csharp-pack.ps1 after_build: # For once the build has completed artifacts: diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj index 3834a2b..090c3d4 100644 --- a/capnpc-csharp/capnpc-csharp.csproj +++ b/capnpc-csharp/capnpc-csharp.csproj @@ -16,9 +16,6 @@ https://github.com/c80k/capnproto-dotnetcore Git capnp capnpc RPC serialization cerealization - 1.3.0 - 1.3.0.0 - 1.3.0.0 Debug;Release diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index 6d5a34f..aa70736 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -8,7 +8,7 @@ $csprojDir = "$scriptDir\..\capnpc-csharp" $csprojFile = "capnpc-csharp.csproj" $installDir = "$chocoDir\install" -dotnet build -c Release "$scriptDir\..\Capnp.Net.sln" +dotnet build -c Release "$scriptDir\..\Capnp.Net.sln" /p:PublicRelease=true dotnet publish -c Release -r win-x86 --self-contained -o "$chocoDir\$id_win_x86\bin" "$csprojDir\$csprojFile" # dotnet publish -c Release -o "$chocoDir\$id\bin" "$csprojDir\$csprojFile" diff --git a/version.json b/version.json index 436aeab..d7759d4 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.0-beta", + "version": "1.3", "publicReleaseRefSpec": [ "^refs/heads/master$", "^refs/heads/v\\d+(?:\\.\\d+)?$" From 0497ebb63fe52a853cfaf093458d6be1ef19e331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:34:19 +0100 Subject: [PATCH 26/45] nbgv-related fixes --- .../CapnpC.CSharp.MsBuild.Generation.csproj | 3 +-- .../CapnpC.CSharp.MsBuild.Generation.nuspec | 6 ++--- Directory.Build.targets | 23 +++++++++++++++++++ version.json | 3 ++- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 Directory.Build.targets diff --git a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj index 44f3dec..92c5f3c 100644 --- a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj +++ b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj @@ -9,9 +9,8 @@ true true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - + $(MSBuildThisFileDirectory)CapnpC.CSharp.MsBuild.Generation.nuspec - version=$(Version);configuration=$(Configuration) true ..\bin\$(Configuration) Debug;Release diff --git a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.nuspec b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.nuspec index e048bb9..e3ad91d 100644 --- a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.nuspec +++ b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.nuspec @@ -21,9 +21,9 @@ - - - + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..20033a9 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,23 @@ + + + + $(NuspecProperties);config=$(Configuration) + $(NuspecProperties);version=$(NuGetPackageVersion) + $(NuspecProperties);SolutionDir=$(SolutionDir) + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/version.json b/version.json index d7759d4..b47b6b2 100644 --- a/version.json +++ b/version.json @@ -7,7 +7,8 @@ ], "cloudBuild": { "buildNumber": { - "enabled": true + "enabled": true, + "setVersionVariables": true } } } \ No newline at end of file From 609b6aaa09b764fe61ded065cc0384105797bc70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:37:17 +0100 Subject: [PATCH 27/45] appveyor/nbgv fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 3752b3e..6bf0ac8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,9 +12,9 @@ install: - dotnet tool install -g . nbgv init: # Good practise, because Windows line endings are different from Unix/Linux ones - - cmd: nbgv cloud - cmd: git config --global core.autocrlf true before_build: + - cmd: nbgv cloud - cmd: dotnet --version - cmd: msbuild -ver - cmd: dotnet restore ./Capnp.Net.Runtime/Capnp.Net.Runtime.csproj --verbosity m From 7e6987f4c5606d39351b2fc9f72d00f201be1b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:39:00 +0100 Subject: [PATCH 28/45] appveyor/nbgv fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6bf0ac8..4ec9ac7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ install: - vcpkg integrate install - vcpkg install capnproto - cd %APPVEYOR_BUILD_FOLDER% - - dotnet tool install -g . nbgv + - dotnet tool install -g nbgv init: # Good practise, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true From 244803a1446d960c8c52e467fff883d15f9e7a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:42:13 +0100 Subject: [PATCH 29/45] nbgv cloud seems to crash --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4ec9ac7..4857f2c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,7 @@ image: Visual Studio 2019 # branches: # only: # - master +version: {build} cache: - c:\Tools\vcpkg\installed install: @@ -14,7 +15,7 @@ init: # Good practise, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true before_build: - - cmd: nbgv cloud +# - cmd: nbgv cloud - cmd: dotnet --version - cmd: msbuild -ver - cmd: dotnet restore ./Capnp.Net.Runtime/Capnp.Net.Runtime.csproj --verbosity m From 6dbf0343142abba49d925bdd2b812fe81f84f45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:42:47 +0100 Subject: [PATCH 30/45] appveyor fix --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4857f2c..234dd96 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ image: Visual Studio 2019 # branches: # only: # - master -version: {build} +version: '{build}' cache: - c:\Tools\vcpkg\installed install: From 6efeaa067871b4094f224b5bed64f23b4f5bdaf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:51:05 +0100 Subject: [PATCH 31/45] does this fix the crash? --- version.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/version.json b/version.json index b47b6b2..d7759d4 100644 --- a/version.json +++ b/version.json @@ -7,8 +7,7 @@ ], "cloudBuild": { "buildNumber": { - "enabled": true, - "setVersionVariables": true + "enabled": true } } } \ No newline at end of file From 5208531ef2f2abc3612e9116449c702f25dd370e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Thu, 2 Jan 2020 23:59:32 +0100 Subject: [PATCH 32/45] no shallow cloning anymore! --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 234dd96..41ad4c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,7 +51,6 @@ artifacts: - path: capnpc-csharp\nupkg\*.nupkg name: capnpc-csharp type: NuGetPackage -clone_depth: 1 test_script: - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll # - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install From 9e7c604108c1c3be5cf98289c6f8e04804973402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 00:40:41 +0100 Subject: [PATCH 33/45] nbgv / choco pack fi --- appveyor.yml | 2 +- scripts/capnpc-csharp-pack.ps1 | 4 ++-- version.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 41ad4c1..80c8bd5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,7 @@ init: # Good practise, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true before_build: -# - cmd: nbgv cloud + - cmd: nbgv cloud - cmd: dotnet --version - cmd: msbuild -ver - cmd: dotnet restore ./Capnp.Net.Runtime/Capnp.Net.Runtime.csproj --verbosity m diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index aa70736..29d11fd 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -1,5 +1,5 @@ -param($version = "1.0.0") - +$jversion = nbgv get-version -f json | ConvertFrom-Json +$version = $($jversion.NuGetPackageVersion) $id = "capnpc-csharp" $id_win_x86 = "capnpc-csharp-win-x86" $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path diff --git a/version.json b/version.json index d7759d4..b47b6b2 100644 --- a/version.json +++ b/version.json @@ -7,7 +7,8 @@ ], "cloudBuild": { "buildNumber": { - "enabled": true + "enabled": true, + "setVersionVariables": true } } } \ No newline at end of file From 83e48fca00bc0a8e849e707aef8a17aa63f4ad3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 01:16:06 +0100 Subject: [PATCH 34/45] removed PublicRelease flag --- appveyor.yml | 2 +- scripts/capnpc-csharp-pack.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 80c8bd5..4c2e316 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,7 +29,7 @@ before_build: - cmd: dotnet restore ./capnpc-csharp/capnpc-csharp.csproj --verbosity m build_script: - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Debug" - - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Release" /p:PublicRelease=true + - cmd: msbuild ./Capnp.Net.sln /p:Configuration="Release" - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Debug" - cmd: msbuild ./CapnpCompatTest.sln /p:Configuration="Release" - ps: scripts\capnpc-csharp-pack.ps1 diff --git a/scripts/capnpc-csharp-pack.ps1 b/scripts/capnpc-csharp-pack.ps1 index 29d11fd..6aadac5 100644 --- a/scripts/capnpc-csharp-pack.ps1 +++ b/scripts/capnpc-csharp-pack.ps1 @@ -8,7 +8,7 @@ $csprojDir = "$scriptDir\..\capnpc-csharp" $csprojFile = "capnpc-csharp.csproj" $installDir = "$chocoDir\install" -dotnet build -c Release "$scriptDir\..\Capnp.Net.sln" /p:PublicRelease=true +dotnet build -c Release "$scriptDir\..\Capnp.Net.sln" dotnet publish -c Release -r win-x86 --self-contained -o "$chocoDir\$id_win_x86\bin" "$csprojDir\$csprojFile" # dotnet publish -c Release -o "$chocoDir\$id\bin" "$csprojDir\$csprojFile" From fbfa827279c1415dba3aa1daf20030b85597c6a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 01:37:31 +0100 Subject: [PATCH 35/45] dotnet tool fix --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 4c2e316..6be8c88 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,7 +57,10 @@ test_script: # - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - - cmd: dotnet tool install --global --add-source ./nupkg capnpc-csharp + - powershell: | + $jversion = nbgv get-version -f json | ConvertFrom-Json + $version = $($jversion.NuGetPackageVersion) + dotnet tool install --global --add-source ./nupkg capnpc-csharp --version $(version) - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - cmd: compile-test - cmd: cd %APPVEYOR_BUILD_FOLDER% From cfce6e87f4f066a709ce3e73ff096f81bebce83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 01:51:26 +0100 Subject: [PATCH 36/45] dotnet tool hack --- appveyor.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6be8c88..5451b4f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,10 +57,9 @@ test_script: # - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - - powershell: | - $jversion = nbgv get-version -f json | ConvertFrom-Json - $version = $($jversion.NuGetPackageVersion) - dotnet tool install --global --add-source ./nupkg capnpc-csharp --version $(version) + - cmd: echo dotnet tool install --global --add-source ./nupkg capnpc-csharp --version > install.bat + - cmd: nbgv get-version -v NuGetPackageVersion >> install.bat + - cmd: install.bat - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - cmd: compile-test - cmd: cd %APPVEYOR_BUILD_FOLDER% From 2248311b5f609d97bcb3f2927e2417f29d8a2286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 01:59:15 +0100 Subject: [PATCH 37/45] dotnet tool test hack (even uglier) --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5451b4f..fe6d357 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,7 +57,7 @@ test_script: # - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - - cmd: echo dotnet tool install --global --add-source ./nupkg capnpc-csharp --version > install.bat + - cmd: echo|set /p="dotnet tool install --global --add-source ./nupkg capnpc-csharp --version " > install.bat - cmd: nbgv get-version -v NuGetPackageVersion >> install.bat - cmd: install.bat - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test From 5bfd40c245e38978ada890473d5323114bb3103f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 02:06:15 +0100 Subject: [PATCH 38/45] dotnet tool test fix (even more uglier) --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index fe6d357..f36ed7b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -57,7 +57,7 @@ test_script: # - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - - cmd: echo|set /p="dotnet tool install --global --add-source ./nupkg capnpc-csharp --version " > install.bat + - cmd: echo|set /p="dotnet tool install --global --add-source ./nupkg capnpc-csharp --version " > install.bat & exit 0 - cmd: nbgv get-version -v NuGetPackageVersion >> install.bat - cmd: install.bat - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test From e075339fecfb88e66ef58ad9ecd14e8c1459c85e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 02:17:07 +0100 Subject: [PATCH 39/45] install test fix (less ugly) --- appveyor.yml | 58 +++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f36ed7b..98510e8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,36 +52,34 @@ artifacts: name: capnpc-csharp type: NuGetPackage test_script: - - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll -# - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install -# - cmd: choco install capnpc-csharp --source=".;https://chocolatey.org/api/v2" --force -y - - cmd: choco install capnproto --source="https://chocolatey.org/api/v2" --force -y - - cmd: cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp - - cmd: echo|set /p="dotnet tool install --global --add-source ./nupkg capnpc-csharp --version " > install.bat & exit 0 - - cmd: nbgv get-version -v NuGetPackageVersion >> install.bat - - cmd: install.bat - - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - - cmd: compile-test - - cmd: cd %APPVEYOR_BUILD_FOLDER% - - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll -# - cmd: choco uninstall capnpc-csharp -y - - cmd: dotnet tool uninstall --global capnpc-csharp - - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - - cmd: notinstalled-test - - cmd: cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install - - cmd: choco install capnpc-csharp-win-x86 --source=".;https://chocolatey.org/api/v2" --force -y - - cmd: cd %APPVEYOR_BUILD_FOLDER%\install-test - - cmd: compile-test - - cmd: choco uninstall capnpc-csharp-win-x86 -y - - cmd: notinstalled-test - - cmd: cd %APPVEYOR_BUILD_FOLDER% - - cmd: vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.MsBuild.Generation.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.MsBuild.Generation.Tests.dll - - cmd: msbuild -t:restore ./MsBuildGenerationTest/MsBuildGenerationTest.csproj /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%" - - cmd: msbuild ./MsBuildGenerationTest/MsBuildGenerationTest.sln /p:Configuration="Debug" /p:PackageReferenceVersion="%APPVEYOR_BUILD_VERSION%" - - cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.Std20.dll - - cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.Std20.dll - - cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll - - cmd: vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll + - cmd: | + nbgv get-version -v NuGetPackageVersion >> version.txt + set /P VERSION=< version.txt + vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll + choco install capnproto --source="https://chocolatey.org/api/v2" --force -y + cd %APPVEYOR_BUILD_FOLDER%\capnpc-csharp + dotnet tool install --global --add-source ./nupkg capnpc-csharp --version %VERSION% + cd %APPVEYOR_BUILD_FOLDER%\install-test + compile-test + cd %APPVEYOR_BUILD_FOLDER% + vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.Generator.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.Generator.Tests.dll + dotnet tool uninstall --global capnpc-csharp + cd %APPVEYOR_BUILD_FOLDER%\install-test + notinstalled-test + cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install + choco install capnpc-csharp-win-x86 --source=".;https://chocolatey.org/api/v2" --force -y + cd %APPVEYOR_BUILD_FOLDER%\install-test + compile-test + choco uninstall capnpc-csharp-win-x86 -y + notinstalled-test + cd %APPVEYOR_BUILD_FOLDER% + vstest.console /logger:Appveyor /inIsolation CapnpC.CSharp.MsBuild.Generation.Tests\bin\Release\netcoreapp2.1\CapnpC.CSharp.MsBuild.Generation.Tests.dll + msbuild -t:restore ./MsBuildGenerationTest/MsBuildGenerationTest.csproj /p:Configuration="Debug" /p:PackageReferenceVersion="%VERSION%" + msbuild ./MsBuildGenerationTest/MsBuildGenerationTest.sln /p:Configuration="Debug" /p:PackageReferenceVersion="%VERSION%" + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Debug\net471\Capnp.Net.Runtime.Tests.Std20.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests\bin\Release\net471\Capnp.Net.Runtime.Tests.Std20.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Debug\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll + vstest.console /logger:Appveyor /inIsolation Capnp.Net.Runtime.Tests.Core21\bin\Release\netcoreapp2.1\Capnp.Net.Runtime.Tests.Core21.dll on_finish : # any cleanup in here deploy: From 5daec1fb11507bc2b203f627f21e2e027c2829a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 3 Jan 2020 02:23:44 +0100 Subject: [PATCH 40/45] force choco install of locally built package --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 98510e8..a42263e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -67,7 +67,7 @@ test_script: cd %APPVEYOR_BUILD_FOLDER%\install-test notinstalled-test cd %APPVEYOR_BUILD_FOLDER%\chocolatey\install - choco install capnpc-csharp-win-x86 --source=".;https://chocolatey.org/api/v2" --force -y + choco install capnpc-csharp-win-x86 --source=".;https://chocolatey.org/api/v2" --force -y --version %VERSION% --pre cd %APPVEYOR_BUILD_FOLDER%\install-test compile-test choco uninstall capnpc-csharp-win-x86 -y From 4bcc97a69fc67ddbbca3ae8c5b6f3c3d7ecd46c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 31 Jan 2020 21:40:25 +0100 Subject: [PATCH 41/45] Fix + test case for issue #37 --- .../Capnp.Net.Runtime.Tests.Core21.csproj | 1 + Capnp.Net.Runtime.Tests/ScatteringStream.cs | 58 +++++++++++++++++++ Capnp.Net.Runtime.Tests/TcpRpcStress.cs | 35 +++++++++++ Capnp.Net.Runtime/Framing.cs | 21 ++++++- Capnp.Net.Runtime/Rpc/IConnection.cs | 3 + Capnp.Net.Runtime/Rpc/TcpRpcClient.cs | 18 +++++- Capnp.Net.Runtime/Rpc/TcpRpcServer.cs | 34 +++++++---- 7 files changed, 155 insertions(+), 15 deletions(-) create mode 100644 Capnp.Net.Runtime.Tests/ScatteringStream.cs diff --git a/Capnp.Net.Runtime.Tests.Core21/Capnp.Net.Runtime.Tests.Core21.csproj b/Capnp.Net.Runtime.Tests.Core21/Capnp.Net.Runtime.Tests.Core21.csproj index 1541a85..30d40e2 100644 --- a/Capnp.Net.Runtime.Tests.Core21/Capnp.Net.Runtime.Tests.Core21.csproj +++ b/Capnp.Net.Runtime.Tests.Core21/Capnp.Net.Runtime.Tests.Core21.csproj @@ -22,6 +22,7 @@ + diff --git a/Capnp.Net.Runtime.Tests/ScatteringStream.cs b/Capnp.Net.Runtime.Tests/ScatteringStream.cs new file mode 100644 index 0000000..e6b44df --- /dev/null +++ b/Capnp.Net.Runtime.Tests/ScatteringStream.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Capnp.Net.Runtime.Tests +{ + /// + /// Imitates the behavior of a TCP connection by real hardware, which splits data transfer into multiple packets. + /// + class ScatteringStream : Stream + { + readonly Stream _baseStream; + readonly int _mtu; + + public ScatteringStream(Stream baseStream, int mtu) + { + _baseStream = baseStream; + _mtu = mtu; + } + + public override bool CanRead => _baseStream.CanRead; + + public override bool CanSeek => false; + + public override bool CanWrite => _baseStream.CanWrite; + + public override long Length => _baseStream.Length; + + public override long Position + { + get => _baseStream.Position; + set => throw new NotImplementedException(); + } + + public override void Flush() => _baseStream.Flush(); + + public override int Read(byte[] buffer, int offset, int count) => _baseStream.Read(buffer, offset, count); + + public override long Seek(long offset, SeekOrigin origin) => throw new NotImplementedException(); + + public override void SetLength(long value) => throw new NotImplementedException(); + + public override void Write(byte[] buffer, int offset, int count) + { + while (count > 0) + { + int amount = Math.Min(count, _mtu); + _baseStream.Write(buffer, offset, amount); + _baseStream.Flush(); + offset += amount; + count -= amount; + } + } + } +} diff --git a/Capnp.Net.Runtime.Tests/TcpRpcStress.cs b/Capnp.Net.Runtime.Tests/TcpRpcStress.cs index d45c45c..6ca2c14 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcStress.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcStress.cs @@ -89,5 +89,40 @@ namespace Capnp.Net.Runtime.Tests var t = new TcpRpc(); Repeat(100, t.PipelineAfterReturn); } + + [TestMethod] + public void ScatteredTransfer() + { + + using (var server = SetupServer()) + using (var client = new TcpRpcClient()) + { + client.InjectMidlayer(s => new ScatteringStream(s, 10)); + client.Connect("localhost", TcpPort); + client.WhenConnected.Wait(); + + var counters = new Counters(); + server.Main = new TestInterfaceImpl(counters); + using (var main = client.GetMain()) + { + for (int i = 0; i < 100; i++) + { + var request1 = main.Foo(123, true, default); + var request3 = Assert.ThrowsExceptionAsync(() => main.Bar(default)); + var s = new TestAllTypes(); + Common.InitTestMessage(s); + var request2 = main.Baz(s, default); + + Assert.IsTrue(request1.Wait(MediumNonDbgTimeout)); + Assert.IsTrue(request2.Wait(MediumNonDbgTimeout)); + Assert.IsTrue(request3.Wait(MediumNonDbgTimeout)); + + Assert.AreEqual("foo", request1.Result); + Assert.AreEqual(2, counters.CallCount); + counters.CallCount = 0; + } + } + } + } } } diff --git a/Capnp.Net.Runtime/Framing.cs b/Capnp.Net.Runtime/Framing.cs index e9707ce..bba2875 100644 --- a/Capnp.Net.Runtime/Framing.cs +++ b/Capnp.Net.Runtime/Framing.cs @@ -79,7 +79,10 @@ namespace Capnp return new WireFrame(buffers); } - + + static InvalidDataException StreamClosed() + => new InvalidDataException("Prematurely reached end of stream. Expected more bytes according to framing header."); + static void FillBuffersFromFrames(Memory[] buffers, uint segmentCount, BinaryReader reader) { for (uint i = 0; i < segmentCount; i++) @@ -90,7 +93,12 @@ namespace Capnp if (tmpBuffer.Length != buffer.Length) { - throw new InvalidDataException("Expected more bytes according to framing header"); + // Note w.r.t. issue #37: If there are temporarily less bytes available, + // this will NOT cause ReadBytes to return a shorter buffer. + // Only if the end of the stream is reached will we enter this branch. And this will be an error condition, + // since it would mean that the connection was closed in the middle of a frame transfer. + + throw StreamClosed(); } // Fastest way to do this without /unsafe @@ -101,7 +109,14 @@ namespace Capnp } #else var buffer = MemoryMarshal.Cast(buffers[i].Span); - reader.Read(buffer); + + while (buffer.Length > 0) + { + int obtained = reader.Read(buffer); + if (obtained == 0) + throw StreamClosed(); + buffer = buffer.Slice(obtained); + } #endif } } diff --git a/Capnp.Net.Runtime/Rpc/IConnection.cs b/Capnp.Net.Runtime/Rpc/IConnection.cs index 582b17e..3a15f6f 100644 --- a/Capnp.Net.Runtime/Rpc/IConnection.cs +++ b/Capnp.Net.Runtime/Rpc/IConnection.cs @@ -1,5 +1,6 @@ using Capnp.FrameTracing; using System; +using System.IO; namespace Capnp.Rpc { @@ -51,6 +52,8 @@ namespace Capnp.Rpc /// Connection is not in state 'Initializing' void AttachTracer(IFrameTracer tracer); + void InjectMidlayer(Func createFunc); + /// /// Prematurely closes this connection. Note that there is usually no need to close a connection manually. The typical use case /// of this method is to refuse an incoming connection in the TcpRpcServer.OnConnectionChanged callback. diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs index 0f3e1a6..293f9a5 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Net; using System.Net.Sockets; using System.Runtime.CompilerServices; @@ -44,6 +45,7 @@ namespace Capnp.Rpc readonly RpcEngine _rpcEngine; readonly TcpClient _client; + Func _createLayers = _ => _; RpcEngine.RpcEndpoint _inboundEndpoint; OutboundTcpEndpoint _outboundEndpoint; FramePump _pump; @@ -82,7 +84,9 @@ namespace Capnp.Rpc await ConnectAsync(host, port); State = ConnectionState.Active; - _pump = new FramePump(_client.GetStream()); + + var stream = _createLayers(_client.GetStream()); + _pump = new FramePump(stream); _attachTracerAction?.Invoke(); _outboundEndpoint = new OutboundTcpEndpoint(this, _pump); _inboundEndpoint = _rpcEngine.AddEndpoint(_outboundEndpoint); @@ -218,6 +222,18 @@ namespace Capnp.Rpc }; } + public void InjectMidlayer(Func createFunc) + { + if (createFunc == null) + throw new ArgumentNullException(nameof(createFunc)); + + if (State != ConnectionState.Initializing) + throw new InvalidOperationException("Connection is not in state 'Initializing'"); + + var last = _createLayers; + _createLayers = _ => createFunc(last(_)); + } + /// /// Prematurely closes this connection. Note that there is usually no need to close a connection manually. /// diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs index 6ac5cb1..f3c0553 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs @@ -2,6 +2,7 @@ using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; +using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; @@ -60,24 +61,29 @@ namespace Capnp.Rpc class Connection: IConnection { readonly TcpRpcServer _server; + Stream _stream; - public Connection(TcpRpcServer server, TcpClient client, FramePump pump, OutboundTcpEndpoint outboundEp, RpcEngine.RpcEndpoint inboundEp) + public Connection(TcpRpcServer server, TcpClient client) { _server = server; Client = client; - Pump = pump; - OutboundEp = outboundEp; - InboundEp = inboundEp; + _stream = client.GetStream(); } public void Start() { + Pump = new FramePump(_stream); + OutboundEp = new OutboundTcpEndpoint(_server, Pump); + InboundEp = _server._rpcEngine.AddEndpoint(OutboundEp); + Pump.FrameReceived += InboundEp.Forward; + + State = ConnectionState.Active; + PumpRunner = new Thread(o => { try { Thread.CurrentThread.Name = $"TCP RPC Server Thread {Thread.CurrentThread.ManagedThreadId}"; - State = ConnectionState.Active; Pump.Run(); } @@ -122,6 +128,17 @@ namespace Capnp.Rpc Pump.AttachTracer(tracer); } + public void InjectMidlayer(Func createFunc) + { + if (createFunc == null) + throw new ArgumentNullException(nameof(createFunc)); + + if (State != ConnectionState.Initializing) + throw new InvalidOperationException("Connection is not in state 'Initializing'"); + + _stream = createFunc(_stream); + } + public void Close() { Client.Dispose(); @@ -149,12 +166,7 @@ namespace Capnp.Rpc while (true) { var client = _listener.AcceptTcpClient(); - var pump = new FramePump(client.GetStream()); - var outboundEndpoint = new OutboundTcpEndpoint(this, pump); - var inboundEndpoint = _rpcEngine.AddEndpoint(outboundEndpoint); - pump.FrameReceived += inboundEndpoint.Forward; - - var connection = new Connection(this, client, pump, outboundEndpoint, inboundEndpoint); + var connection = new Connection(this, client); lock (_reentrancyBlocker) { From 72308d38d5d4911be062d327aa966b1b4fd8d921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Fri, 31 Jan 2020 22:13:41 +0100 Subject: [PATCH 42/45] rollback version to 1.2 (critical fix #37) --- Capnp.Net.Runtime/Capnp.Net.Runtime.csproj | 2 +- .../CapnpC.CSharp.MsBuild.Generation.csproj | 6 +++--- MsBuildGenerationTest/MsBuildGenerationTest.csproj | 2 +- appveyor.yml | 2 +- capnpc-csharp/capnpc-csharp.csproj | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj index 2d6ac0e..bb63b16 100644 --- a/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj +++ b/Capnp.Net.Runtime/Capnp.Net.Runtime.csproj @@ -18,7 +18,7 @@ MIT Git capnp "Cap'n Proto" RPC serialization cerealization - 1.3-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) + 1.2-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) Debug;Release true diff --git a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj index c2aa0e7..3f7d27f 100644 --- a/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj +++ b/CapnpC.CSharp.MsBuild.Generation/CapnpC.CSharp.MsBuild.Generation.csproj @@ -9,9 +9,9 @@ true true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - 1.3.0.0 - 1.3.0.0 - 1.3-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) + 1.2.0.0 + 1.2.0.0 + 1.2-local$([System.DateTime]::UtcNow.ToString(yyMMddHHmm)) $(MSBuildThisFileDirectory)CapnpC.CSharp.MsBuild.Generation.nuspec version=$(Version);configuration=$(Configuration) diff --git a/MsBuildGenerationTest/MsBuildGenerationTest.csproj b/MsBuildGenerationTest/MsBuildGenerationTest.csproj index c415422..3c7c246 100644 --- a/MsBuildGenerationTest/MsBuildGenerationTest.csproj +++ b/MsBuildGenerationTest/MsBuildGenerationTest.csproj @@ -3,7 +3,7 @@ Exe netcoreapp2.2 - 1.3-local + 1.2-local Debug;Release $(Version)* diff --git a/appveyor.yml b/appveyor.yml index bfbe4fb..b18d96d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '1.3.{build}' +version: '1.2.{build}' image: Visual Studio 2019 # branches: # only: diff --git a/capnpc-csharp/capnpc-csharp.csproj b/capnpc-csharp/capnpc-csharp.csproj index f5088f0..373c3a3 100644 --- a/capnpc-csharp/capnpc-csharp.csproj +++ b/capnpc-csharp/capnpc-csharp.csproj @@ -13,7 +13,7 @@ https://github.com/c80k/capnproto-dotnetcore Git capnp capnpc RPC serialization cerealization - 1.3.0 + 1.2.0 Debug;Release From 1ec5b0e955df435905b5397e5c08920af55aa98e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Sat, 1 Feb 2020 13:49:45 +0100 Subject: [PATCH 43/45] Improvements w.r.t. issue #37 --- Capnp.Net.Runtime.Tests/TcpRpcStress.cs | 11 ++++++++++- Capnp.Net.Runtime/Framing.cs | 3 ++- Capnp.Net.Runtime/Rpc/IConnection.cs | 7 +++++++ Capnp.Net.Runtime/Rpc/TcpRpcClient.cs | 7 +++++++ Capnp.Net.Runtime/Rpc/TcpRpcServer.cs | 7 +++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Capnp.Net.Runtime.Tests/TcpRpcStress.cs b/Capnp.Net.Runtime.Tests/TcpRpcStress.cs index 6ca2c14..8409ace 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcStress.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcStress.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using System.Net; using System.Text; using System.Threading; @@ -94,9 +95,17 @@ namespace Capnp.Net.Runtime.Tests public void ScatteredTransfer() { - using (var server = SetupServer()) + using (var server = new TcpRpcServer(IPAddress.Any, TcpPort)) using (var client = new TcpRpcClient()) { + server.OnConnectionChanged += (_, e) => + { + if (e.Connection.State == ConnectionState.Initializing) + { + e.Connection.InjectMidlayer(s => new ScatteringStream(s, 7)); + } + }; + client.InjectMidlayer(s => new ScatteringStream(s, 10)); client.Connect("localhost", TcpPort); client.WhenConnected.Wait(); diff --git a/Capnp.Net.Runtime/Framing.cs b/Capnp.Net.Runtime/Framing.cs index bba2875..8e39cc5 100644 --- a/Capnp.Net.Runtime/Framing.cs +++ b/Capnp.Net.Runtime/Framing.cs @@ -110,13 +110,14 @@ namespace Capnp #else var buffer = MemoryMarshal.Cast(buffers[i].Span); - while (buffer.Length > 0) + do { int obtained = reader.Read(buffer); if (obtained == 0) throw StreamClosed(); buffer = buffer.Slice(obtained); } + while (buffer.Length > 0); #endif } } diff --git a/Capnp.Net.Runtime/Rpc/IConnection.cs b/Capnp.Net.Runtime/Rpc/IConnection.cs index 3a15f6f..b18fc5c 100644 --- a/Capnp.Net.Runtime/Rpc/IConnection.cs +++ b/Capnp.Net.Runtime/Rpc/IConnection.cs @@ -52,6 +52,13 @@ namespace Capnp.Rpc /// Connection is not in state 'Initializing' void AttachTracer(IFrameTracer tracer); + /// + /// Installs a midlayer. A midlayer is a protocal layer that resides somewhere between capnp serialization and the raw TCP stream. + /// Thus, we have a hook mechanism for transforming data before it is sent to the TCP connection or after it was received + /// by the TCP connection, respectively. This mechanism may be used for integrating various (de-)compression algorithms. + /// + /// Callback for wrapping the midlayer around its underlying stream + /// is null void InjectMidlayer(Func createFunc); /// diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs index 293f9a5..def2f78 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcClient.cs @@ -222,6 +222,13 @@ namespace Capnp.Rpc }; } + /// + /// Installs a midlayer. A midlayer is a protocal layer that resides somewhere between capnp serialization and the raw TCP stream. + /// Thus, we have a hook mechanism for transforming data before it is sent to the TCP connection or after it was received + /// by the TCP connection, respectively. This mechanism may be used for integrating various (de-)compression algorithms. + /// + /// Callback for wrapping the midlayer around its underlying stream + /// is null public void InjectMidlayer(Func createFunc) { if (createFunc == null) diff --git a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs index f3c0553..131f0ce 100644 --- a/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs +++ b/Capnp.Net.Runtime/Rpc/TcpRpcServer.cs @@ -128,6 +128,13 @@ namespace Capnp.Rpc Pump.AttachTracer(tracer); } + /// + /// Installs a midlayer. A midlayer is a protocal layer that resides somewhere between capnp serialization and the raw TCP stream. + /// Thus, we have a hook mechanism for transforming data before it is sent to the TCP connection or after it was received + /// by the TCP connection, respectively. This mechanism may be used for integrating various (de-)compression algorithms. + /// + /// Callback for wrapping the midlayer around its underlying stream + /// is null public void InjectMidlayer(Func createFunc) { if (createFunc == null) From bb1a8bf51c0a917705d404125032281ced2bfcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Sat, 1 Feb 2020 14:10:05 +0100 Subject: [PATCH 44/45] improved test output --- Capnp.Net.Runtime.Tests/TcpRpcPorted.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs b/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs index 3402ce9..db6a450 100644 --- a/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs +++ b/Capnp.Net.Runtime.Tests/TcpRpcPorted.cs @@ -484,7 +484,7 @@ namespace Capnp.Net.Runtime.Tests } catch (AggregateException exception) when (exception.InnerException is RpcException rpcException && rpcException.Message == "Cannot access a disposed object.") { - Logger.Log(LogLevel.Information, $"Oops, object disposed. Counter = {cap.Count}, tx count = {client.SendCount}, rx count = {client.RecvCount}"); + Console.WriteLine($"Oops, object disposed. Counter = {cap.Count}, tx count = {client.SendCount}, rx count = {client.RecvCount}"); throw; } From 3a429462e6c9b134fbf821c7043062ae9221d1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6llner?= Date: Sat, 8 Feb 2020 18:36:21 +0100 Subject: [PATCH 45/45] added benchmarking suite --- Benchmarking/Benchmark/Benchmark.csproj | 24 ++++++++++ Benchmarking/Benchmark/CapnpBenchmark.cs | 46 +++++++++++++++++++ Benchmarking/Benchmark/GrpcBenchmark.cs | 42 +++++++++++++++++ Benchmarking/Benchmark/Program.cs | 18 ++++++++ Benchmarking/Benchmark/Protos/Echo.capnp | 5 ++ Benchmarking/Benchmark/Protos/Echo.proto | 13 ++++++ Benchmarking/CapnpBench.sln | 37 +++++++++++++++ .../EchoServiceCapnp/EchoServiceCapnp.csproj | 13 ++++++ Benchmarking/EchoServiceCapnp/Program.cs | 20 ++++++++ .../EchoServiceCapnp/Protos/Echo.capnp | 5 ++ .../Services/CapnpEchoService.cs | 20 ++++++++ .../EchoServiceGrpc/EchoServiceGrpc.csproj | 15 ++++++ Benchmarking/EchoServiceGrpc/Program.cs | 27 +++++++++++ .../EchoServiceGrpc/Protos/Echo.proto | 13 ++++++ .../Services/GrpcEchoService.cs | 26 +++++++++++ Benchmarking/EchoServiceGrpc/Startup.cs | 43 +++++++++++++++++ .../appsettings.Development.json | 10 ++++ Benchmarking/EchoServiceGrpc/appsettings.json | 15 ++++++ 18 files changed, 392 insertions(+) create mode 100644 Benchmarking/Benchmark/Benchmark.csproj create mode 100644 Benchmarking/Benchmark/CapnpBenchmark.cs create mode 100644 Benchmarking/Benchmark/GrpcBenchmark.cs create mode 100644 Benchmarking/Benchmark/Program.cs create mode 100644 Benchmarking/Benchmark/Protos/Echo.capnp create mode 100644 Benchmarking/Benchmark/Protos/Echo.proto create mode 100644 Benchmarking/CapnpBench.sln create mode 100644 Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj create mode 100644 Benchmarking/EchoServiceCapnp/Program.cs create mode 100644 Benchmarking/EchoServiceCapnp/Protos/Echo.capnp create mode 100644 Benchmarking/EchoServiceCapnp/Services/CapnpEchoService.cs create mode 100644 Benchmarking/EchoServiceGrpc/EchoServiceGrpc.csproj create mode 100644 Benchmarking/EchoServiceGrpc/Program.cs create mode 100644 Benchmarking/EchoServiceGrpc/Protos/Echo.proto create mode 100644 Benchmarking/EchoServiceGrpc/Services/GrpcEchoService.cs create mode 100644 Benchmarking/EchoServiceGrpc/Startup.cs create mode 100644 Benchmarking/EchoServiceGrpc/appsettings.Development.json create mode 100644 Benchmarking/EchoServiceGrpc/appsettings.json diff --git a/Benchmarking/Benchmark/Benchmark.csproj b/Benchmarking/Benchmark/Benchmark.csproj new file mode 100644 index 0000000..805886e --- /dev/null +++ b/Benchmarking/Benchmark/Benchmark.csproj @@ -0,0 +1,24 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/Benchmarking/Benchmark/CapnpBenchmark.cs b/Benchmarking/Benchmark/CapnpBenchmark.cs new file mode 100644 index 0000000..63f3f1d --- /dev/null +++ b/Benchmarking/Benchmark/CapnpBenchmark.cs @@ -0,0 +1,46 @@ +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Jobs; +using Capnp.Rpc; +using CapnpGen; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Benchmark +{ + public class CapnpBenchmark + { + [Params(20, 200, 2000, 20000, 200000, 2000000)] + public int PayloadBytes; + + TcpRpcClient _client; + IEchoer _echoer; + byte[] _payload; + + [GlobalSetup] + public void Setup() + { + _client = new TcpRpcClient("localhost", 5002); + _client.WhenConnected.Wait(); + _echoer = _client.GetMain(); + _payload = new byte[PayloadBytes]; + new Random().NextBytes(_payload); + } + + [GlobalCleanup] + public void Cleanup() + { + _echoer.Dispose(); + _client.Dispose(); + } + + [Benchmark] + public void Echo() + { + var t = _echoer.Echo(_payload); + t.Wait(); + if (t.Result?.Count != _payload.Length) + throw new InvalidOperationException("Echo server malfunction"); + } + } +} diff --git a/Benchmarking/Benchmark/GrpcBenchmark.cs b/Benchmarking/Benchmark/GrpcBenchmark.cs new file mode 100644 index 0000000..573d7c2 --- /dev/null +++ b/Benchmarking/Benchmark/GrpcBenchmark.cs @@ -0,0 +1,42 @@ +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Jobs; +using Grpc.Net.Client; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Benchmark +{ + public class GrpcBenchmark + { + [Params(20, 200, 2000, 20000, 200000, 2000000)] + public int PayloadBytes; + + GrpcChannel _channel; + Echoer.EchoerClient _echoer; + byte[] _payload; + + [GlobalSetup] + public void Setup() + { + _channel = GrpcChannel.ForAddress("https://localhost:5001"); + _echoer = new Echoer.EchoerClient(_channel); + _payload = new byte[PayloadBytes]; + new Random().NextBytes(_payload); + } + + [GlobalCleanup] + public void Teardown() + { + _channel.Dispose(); + } + + [Benchmark] + public void Echo() + { + var reply = _echoer.Echo(new EchoRequest { Payload = Google.Protobuf.ByteString.CopyFrom(_payload) }); + if (reply?.Payload?.Length != _payload.Length) + throw new InvalidOperationException("Echo server malfunction"); + } + } +} diff --git a/Benchmarking/Benchmark/Program.cs b/Benchmarking/Benchmark/Program.cs new file mode 100644 index 0000000..16a0924 --- /dev/null +++ b/Benchmarking/Benchmark/Program.cs @@ -0,0 +1,18 @@ +using BenchmarkDotNet.Running; +using Capnp.Rpc; +using Grpc.Net.Client; +using System; +using System.Diagnostics; +using System.Threading.Tasks; + +namespace Benchmark +{ + class Program + { + static void Main(string[] args) + { + BenchmarkRunner.Run(); + BenchmarkRunner.Run(); + } + } +} diff --git a/Benchmarking/Benchmark/Protos/Echo.capnp b/Benchmarking/Benchmark/Protos/Echo.capnp new file mode 100644 index 0000000..2af55d5 --- /dev/null +++ b/Benchmarking/Benchmark/Protos/Echo.capnp @@ -0,0 +1,5 @@ +@0x8c309c720de8cf7c; + +interface Echoer { + echo @0 (input : Data) -> (output : Data); +} diff --git a/Benchmarking/Benchmark/Protos/Echo.proto b/Benchmarking/Benchmark/Protos/Echo.proto new file mode 100644 index 0000000..ddbbaea --- /dev/null +++ b/Benchmarking/Benchmark/Protos/Echo.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +service Echoer { + rpc Echo (EchoRequest) returns (EchoReply); +} + +message EchoRequest { + bytes payload = 1; +} + +message EchoReply { + bytes payload = 1; +} \ No newline at end of file diff --git a/Benchmarking/CapnpBench.sln b/Benchmarking/CapnpBench.sln new file mode 100644 index 0000000..061559d --- /dev/null +++ b/Benchmarking/CapnpBench.sln @@ -0,0 +1,37 @@ + +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}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "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}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D59C7B71-3887-426B-A636-2DBDA0549817}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D59C7B71-3887-426B-A636-2DBDA0549817}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D59C7B71-3887-426B-A636-2DBDA0549817}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D59C7B71-3887-426B-A636-2DBDA0549817}.Release|Any CPU.Build.0 = Release|Any CPU + {7F7580CA-CCF0-4650-87BF-502D51A8F435}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F7580CA-CCF0-4650-87BF-502D51A8F435}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F7580CA-CCF0-4650-87BF-502D51A8F435}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F7580CA-CCF0-4650-87BF-502D51A8F435}.Release|Any CPU.Build.0 = Release|Any CPU + {309A4A26-F29E-4F49-AB49-76BAE0FD7D62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A6702BC8-8CC0-4BDA-8BD5-D5D268291E93} + EndGlobalSection +EndGlobal diff --git a/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj b/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj new file mode 100644 index 0000000..f50d2fa --- /dev/null +++ b/Benchmarking/EchoServiceCapnp/EchoServiceCapnp.csproj @@ -0,0 +1,13 @@ + + + + Exe + netcoreapp3.1 + + + + + + + + diff --git a/Benchmarking/EchoServiceCapnp/Program.cs b/Benchmarking/EchoServiceCapnp/Program.cs new file mode 100644 index 0000000..fb58c04 --- /dev/null +++ b/Benchmarking/EchoServiceCapnp/Program.cs @@ -0,0 +1,20 @@ +using Capnp.Rpc; +using EchoServiceCapnp.Services; +using System; +using System.Net; + +namespace EchoServiceCapnp +{ + class Program + { + static void Main(string[] args) + { + using (var server = new TcpRpcServer(IPAddress.Any, 5002)) + { + server.Main = new CapnpEchoService(); + Console.WriteLine("Press RETURN to stop listening"); + Console.ReadLine(); + } + } + } +} diff --git a/Benchmarking/EchoServiceCapnp/Protos/Echo.capnp b/Benchmarking/EchoServiceCapnp/Protos/Echo.capnp new file mode 100644 index 0000000..2af55d5 --- /dev/null +++ b/Benchmarking/EchoServiceCapnp/Protos/Echo.capnp @@ -0,0 +1,5 @@ +@0x8c309c720de8cf7c; + +interface Echoer { + echo @0 (input : Data) -> (output : Data); +} diff --git a/Benchmarking/EchoServiceCapnp/Services/CapnpEchoService.cs b/Benchmarking/EchoServiceCapnp/Services/CapnpEchoService.cs new file mode 100644 index 0000000..60e7afb --- /dev/null +++ b/Benchmarking/EchoServiceCapnp/Services/CapnpEchoService.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace EchoServiceCapnp.Services +{ + public class CapnpEchoService : CapnpGen.IEchoer + { + public void Dispose() + { + } + + public Task> Echo(IReadOnlyList input, CancellationToken cancellationToken_ = default) + { + return Task.FromResult(input); + } + } +} diff --git a/Benchmarking/EchoServiceGrpc/EchoServiceGrpc.csproj b/Benchmarking/EchoServiceGrpc/EchoServiceGrpc.csproj new file mode 100644 index 0000000..861d83c --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/EchoServiceGrpc.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.1 + + + + + + + + + + + diff --git a/Benchmarking/EchoServiceGrpc/Program.cs b/Benchmarking/EchoServiceGrpc/Program.cs new file mode 100644 index 0000000..f24aee5 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/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 EchoService +{ + 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/EchoServiceGrpc/Protos/Echo.proto b/Benchmarking/EchoServiceGrpc/Protos/Echo.proto new file mode 100644 index 0000000..b1b0c0d --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/Protos/Echo.proto @@ -0,0 +1,13 @@ +syntax = "proto3"; + +service Echoer { + rpc Echo (EchoRequest) returns (EchoReply); +} + +message EchoRequest { + bytes payload = 1; +} + +message EchoReply { + bytes payload = 1; +} \ No newline at end of file diff --git a/Benchmarking/EchoServiceGrpc/Services/GrpcEchoService.cs b/Benchmarking/EchoServiceGrpc/Services/GrpcEchoService.cs new file mode 100644 index 0000000..71a7ef9 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/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/EchoServiceGrpc/Startup.cs b/Benchmarking/EchoServiceGrpc/Startup.cs new file mode 100644 index 0000000..b93a112 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/Startup.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace EchoService +{ + 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/EchoServiceGrpc/appsettings.Development.json b/Benchmarking/EchoServiceGrpc/appsettings.Development.json new file mode 100644 index 0000000..1ca5366 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "System": "Warning", + "Grpc": "Warning", + "Microsoft": "Warning" + } + } +} diff --git a/Benchmarking/EchoServiceGrpc/appsettings.json b/Benchmarking/EchoServiceGrpc/appsettings.json new file mode 100644 index 0000000..3110458 --- /dev/null +++ b/Benchmarking/EchoServiceGrpc/appsettings.json @@ -0,0 +1,15 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Warning" + } + }, + "AllowedHosts": "*", + "Kestrel": { + "EndpointDefaults": { + "Protocols": "Http2" + } + } +}