build_packages.bat 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. @rem Builds gRPC NuGet packages
  2. @rem Current package versions
  3. set VERSION=0.14.0-dev
  4. set PROTOBUF_VERSION=3.0.0-beta2
  5. @rem Packages that depend on prerelease packages (like Google.Protobuf) need to have prerelease suffix as well.
  6. set VERSION_WITH_BETA=%VERSION%-beta
  7. @rem Adjust the location of nuget.exe
  8. set NUGET=C:\nuget\nuget.exe
  9. @rem Collect the artifacts built by the previous build step if running on Jenkins
  10. @rem TODO(jtattermusch): is there a better way to do this?
  11. xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x86\
  12. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x64\
  13. xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x86\
  14. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x64\
  15. xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x86\
  16. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x64\
  17. @rem Collect protoc artifacts built by the previous build step
  18. xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86\
  19. xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x64\
  20. xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x86\
  21. xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x64\
  22. xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86\
  23. xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64\
  24. @rem Fetch all dependencies
  25. %NUGET% restore ..\..\vsprojects\grpc_csharp_ext.sln || goto :error
  26. %NUGET% restore Grpc.sln || goto :error
  27. setlocal
  28. @call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
  29. @rem We won't use the native libraries from this step, but without this Grpc.sln will fail.
  30. msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:PlatformToolset=v120 || goto :error
  31. msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error
  32. endlocal
  33. %NUGET% pack grpc.native.csharp\grpc.native.csharp.nuspec -Version %VERSION% || goto :error
  34. %NUGET% pack Grpc.Auth\Grpc.Auth.nuspec -Symbols -Version %VERSION% || goto :error
  35. %NUGET% pack Grpc.Core\Grpc.Core.nuspec -Symbols -Version %VERSION% || goto :error
  36. %NUGET% pack Grpc.HealthCheck\Grpc.HealthCheck.nuspec -Symbols -Version %VERSION_WITH_BETA% -Properties ProtobufVersion=%PROTOBUF_VERSION% || goto :error
  37. %NUGET% pack Grpc.nuspec -Version %VERSION% || goto :error
  38. %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error
  39. @rem copy resulting nuget packages to artifacts directory
  40. xcopy /Y /I *.nupkg ..\..\artifacts\
  41. @rem create a zipfile with the artifacts as well
  42. powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('..\..\artifacts', 'csharp_nugets.zip');"
  43. xcopy /Y /I csharp_nugets.zip ..\..\artifacts\
  44. goto :EOF
  45. :error
  46. echo Failed!
  47. exit /b %errorlevel%