From 84be265239bbc1d1313aa5a0a79b724a847ff5f1 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 27 Oct 2016 23:52:16 -0700 Subject: [PATCH 1/2] strong name sign csharp nuget builds with dotnet on windows --- src/csharp/Grpc.Auth/project.json | 1 - src/csharp/Grpc.Core.Tests/project.json | 2 - src/csharp/Grpc.Core/project.json | 1 - .../Grpc.Examples.MathClient/project.json | 2 - .../Grpc.Examples.MathServer/project.json | 2 - src/csharp/Grpc.Examples.Tests/project.json | 2 - .../Grpc.HealthCheck.Tests/project.json | 2 - src/csharp/Grpc.HealthCheck/project.json | 1 - .../project.json | 2 - .../project.json | 2 - .../project.json | 2 - .../project.json | 2 - .../Grpc.IntegrationTesting/project.json | 2 - src/csharp/build_packages_dotnetcli.bat | 79 +++++++++++++++++++ .../csharp/Grpc.Auth/project.json.template | 1 - .../csharp/Grpc.Core/project.json.template | 1 - .../Grpc.HealthCheck/project.json.template | 1 - templates/src/csharp/build_options.include | 2 - tools/run_tests/package_targets.py | 11 +-- 19 files changed, 81 insertions(+), 37 deletions(-) create mode 100755 src/csharp/build_packages_dotnetcli.bat diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 6b0df9045a1..06e76b3b7f7 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -15,7 +15,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.Core.Tests/project.json b/src/csharp/Grpc.Core.Tests/project.json index faf28dcee84..509084a71a6 100644 --- a/src/csharp/Grpc.Core.Tests/project.json +++ b/src/csharp/Grpc.Core.Tests/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -26,7 +25,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.Core/project.json b/src/csharp/Grpc.Core/project.json index 29d35555c07..dabc05ad276 100644 --- a/src/csharp/Grpc.Core/project.json +++ b/src/csharp/Grpc.Core/project.json @@ -27,7 +27,6 @@ "embed": [ "../../../etc/roots.pem" ], "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true }, "dependencies": { diff --git a/src/csharp/Grpc.Examples.MathClient/project.json b/src/csharp/Grpc.Examples.MathClient/project.json index 628f5329661..9a8880b5d42 100644 --- a/src/csharp/Grpc.Examples.MathClient/project.json +++ b/src/csharp/Grpc.Examples.MathClient/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -26,7 +25,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.Examples.MathServer/project.json b/src/csharp/Grpc.Examples.MathServer/project.json index 628f5329661..9a8880b5d42 100644 --- a/src/csharp/Grpc.Examples.MathServer/project.json +++ b/src/csharp/Grpc.Examples.MathServer/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -26,7 +25,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.Examples.Tests/project.json b/src/csharp/Grpc.Examples.Tests/project.json index 0109617e6b5..3e130beeac9 100644 --- a/src/csharp/Grpc.Examples.Tests/project.json +++ b/src/csharp/Grpc.Examples.Tests/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -26,7 +25,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.HealthCheck.Tests/project.json b/src/csharp/Grpc.HealthCheck.Tests/project.json index 66dcd79a397..addc782afe8 100644 --- a/src/csharp/Grpc.HealthCheck.Tests/project.json +++ b/src/csharp/Grpc.HealthCheck.Tests/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -26,7 +25,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 62aa361efa2..72ab64a06d5 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -15,7 +15,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.IntegrationTesting.Client/project.json b/src/csharp/Grpc.IntegrationTesting.Client/project.json index 1b900c8af32..ad81cbc48b3 100644 --- a/src/csharp/Grpc.IntegrationTesting.Client/project.json +++ b/src/csharp/Grpc.IntegrationTesting.Client/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -29,7 +28,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json b/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json index 1b900c8af32..ad81cbc48b3 100644 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json +++ b/src/csharp/Grpc.IntegrationTesting.QpsWorker/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -29,7 +28,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.IntegrationTesting.Server/project.json b/src/csharp/Grpc.IntegrationTesting.Server/project.json index 1b900c8af32..ad81cbc48b3 100644 --- a/src/csharp/Grpc.IntegrationTesting.Server/project.json +++ b/src/csharp/Grpc.IntegrationTesting.Server/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -29,7 +28,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json b/src/csharp/Grpc.IntegrationTesting.StressClient/project.json index 1b900c8af32..ad81cbc48b3 100644 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/project.json +++ b/src/csharp/Grpc.IntegrationTesting.StressClient/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -29,7 +28,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/Grpc.IntegrationTesting/project.json b/src/csharp/Grpc.IntegrationTesting/project.json index 0225abb4148..e47b5953da0 100644 --- a/src/csharp/Grpc.IntegrationTesting/project.json +++ b/src/csharp/Grpc.IntegrationTesting/project.json @@ -7,7 +7,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -29,7 +28,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat new file mode 100755 index 00000000000..b0e358fdff9 --- /dev/null +++ b/src/csharp/build_packages_dotnetcli.bat @@ -0,0 +1,79 @@ +@rem Copyright 2016, Google Inc. +@rem All rights reserved. +@rem +@rem Redistribution and use in source and binary forms, with or without +@rem modification, are permitted provided that the following conditions are +@rem met: +@rem +@rem * Redistributions of source code must retain the above copyright +@rem notice, this list of conditions and the following disclaimer. +@rem * Redistributions in binary form must reproduce the above +@rem copyright notice, this list of conditions and the following disclaimer +@rem in the documentation and/or other materials provided with the +@rem distribution. +@rem * Neither the name of Google Inc. nor the names of its +@rem contributors may be used to endorse or promote products derived from +@rem this software without specific prior written permission. +@rem +@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +@rem Current package versions +set VERSION=1.0.1 +set PROTOBUF_VERSION=3.0.0 + +@rem Adjust the location of nuget.exe +set NUGET=C:\nuget\nuget.exe +set DOTNET=C:\dotnet\dotnet.exe + +set -ex + +mkdir -p ..\..\artifacts\ + +@rem Collect the artifacts built by the previous build step if running on Jenkins +@rem TODO(jtattermusch): is there a better way to do this? +xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* nativelibs\windows_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* nativelibs\windows_x64\ +xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* nativelibs\linux_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* nativelibs\linux_x64\ +xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* nativelibs\macosx_x64\ + +@rem Collect protoc artifacts built by the previous build step +xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86\ +xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x64\ +xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x86\ +xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x64\ +xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86\ +xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64\ + +%DOTNET% restore . || goto :error + +%DOTNET% pack --configuration Release Grpc.Core\project.json --output ..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.Auth\project.json --output ..\..\artifacts || goto :error +%DOTNET% pack --configuration Release Grpc.HealthCheck\project.json --output ..\..\artifacts || goto :error + +%NUGET% pack Grpc.nuspec -Version "1.0.1" -OutputDirectory ..\..\artifacts || goto :error +%NUGET% pack Grpc.Tools.nuspec -Version "1.0.1" -OutputDirectory ..\..\artifacts + +@rem copy resulting nuget packages to artifacts directory +xcopy /Y /I *.nupkg ..\..\artifacts\ || goto :error + +@rem create a zipfile with the artifacts as well +powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('..\..\artifacts', 'csharp_nugets_windows_dotnetcli.zip');" +xcopy /Y /I csharp_nugets_windows_dotnetcli.zip ..\..\artifacts\ || goto :error + +goto :EOF + +:error +echo Failed! +exit /b %errorlevel% diff --git a/templates/src/csharp/Grpc.Auth/project.json.template b/templates/src/csharp/Grpc.Auth/project.json.template index 939a0c8d280..8bcac1ac740 100644 --- a/templates/src/csharp/Grpc.Auth/project.json.template +++ b/templates/src/csharp/Grpc.Auth/project.json.template @@ -17,7 +17,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/templates/src/csharp/Grpc.Core/project.json.template b/templates/src/csharp/Grpc.Core/project.json.template index fcbef536c63..88895e7b6ca 100644 --- a/templates/src/csharp/Grpc.Core/project.json.template +++ b/templates/src/csharp/Grpc.Core/project.json.template @@ -29,7 +29,6 @@ "embed": [ "../../../etc/roots.pem" ], "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true }, "dependencies": { diff --git a/templates/src/csharp/Grpc.HealthCheck/project.json.template b/templates/src/csharp/Grpc.HealthCheck/project.json.template index 46307dda002..cba68940153 100644 --- a/templates/src/csharp/Grpc.HealthCheck/project.json.template +++ b/templates/src/csharp/Grpc.HealthCheck/project.json.template @@ -17,7 +17,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/templates/src/csharp/build_options.include b/templates/src/csharp/build_options.include index bda2d760747..9a32b7c6f45 100644 --- a/templates/src/csharp/build_options.include +++ b/templates/src/csharp/build_options.include @@ -10,7 +10,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] @@ -34,7 +33,6 @@ "buildOptions": { "define": [ "SIGNED" ], "keyFile": "../keys/Grpc.snk", - "publicSign": true, "xmlDoc": true, "compile": { "includeFiles": [ "../Grpc.Core/Version.cs" ] diff --git a/tools/run_tests/package_targets.py b/tools/run_tests/package_targets.py index 14d30cf06d6..1b66b5d9357 100644 --- a/tools/run_tests/package_targets.py +++ b/tools/run_tests/package_targets.py @@ -81,14 +81,7 @@ class CSharpPackage: self.labels += ['windows'] def pre_build_jobspecs(self): - if 'windows' in self.labels: - return [create_jobspec('prebuild_%s' % self.name, - ['tools\\run_tests\\pre_build_csharp.bat'], - shell=True, - flake_retries=5, - timeout_retries=2)] - else: - return [] + return [] # now using dotnet cli to build all packages def build_jobspec(self): if self.use_dotnet_cli: @@ -98,7 +91,7 @@ class CSharpPackage: 'src/csharp/build_packages_dotnetcli.sh') else: return create_jobspec(self.name, - ['build_packages.bat'], + ['build_packages_dotnetcli.bat'], cwd='src\\csharp', shell=True) From c064ff4e5667282545d23954b90b912da5362799 Mon Sep 17 00:00:00 2001 From: Alex Polcyn Date: Tue, 1 Nov 2016 18:58:56 -0700 Subject: [PATCH 2/2] keep old obsolete csharp package builds but add windows dotnetcli package build. change names of package build targets too --- tools/run_tests/package_targets.py | 40 ++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/tools/run_tests/package_targets.py b/tools/run_tests/package_targets.py index 1b66b5d9357..05183db87cc 100644 --- a/tools/run_tests/package_targets.py +++ b/tools/run_tests/package_targets.py @@ -71,29 +71,52 @@ def create_jobspec(name, cmdline, environ=None, cwd=None, shell=False, class CSharpPackage: """Builds C# nuget packages.""" - def __init__(self, use_dotnet_cli=False): + def __init__(self, linux=False, use_dotnet_cli=True): + self.linux = linux self.use_dotnet_cli = use_dotnet_cli - self.name = 'csharp_package_dotnetcli' if use_dotnet_cli else 'csharp_package' + self.labels = ['package', 'csharp'] + if use_dotnet_cli: - self.labels += ['linux'] + if linux: + self.name = 'csharp_package_dotnetcli_linux' + self.labels += ['linux'] + else: + self.name = 'csharp_package_dotnetcli_windows' + self.labels += ['windows'] else: - self.labels += ['windows'] + # official packages built with dotnet cli rather than nuget pack + self.name = 'csharp_package_obsolete' + self.labels += ['obsolete'] + def pre_build_jobspecs(self): - return [] # now using dotnet cli to build all packages + # The older, obsolete build uses nuget only instead of dotnet cli + if 'obsolete' in self.labels: + return [create_jobspec('prebuild_%s' % self.name, + ['tools\\run_tests\\pre_build_csharp.bat'], + shell=True, + flake_retries=5, + timeout_retries=2)] + else: + return [] def build_jobspec(self): - if self.use_dotnet_cli: + if self.use_dotnet_cli and self.linux: return create_docker_jobspec( self.name, 'tools/dockerfile/test/csharp_coreclr_x64', 'src/csharp/build_packages_dotnetcli.sh') - else: + elif self.use_dotnet_cli: return create_jobspec(self.name, ['build_packages_dotnetcli.bat'], cwd='src\\csharp', shell=True) + else: + return create_jobspec(self.name, + ['build_packages.bat'], + cwd='src\\csharp', + shell=True) def __str__(self): return self.name @@ -170,7 +193,8 @@ class PHPPackage: def targets(): """Gets list of supported targets""" return [CSharpPackage(), - CSharpPackage(use_dotnet_cli=True), + CSharpPackage(linux=True), + CSharpPackage(use_dotnet_cli=False), NodePackage(), RubyPackage(), PythonPackage(),