build_packages.bat 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.Core\windows_x86\
  12. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* Grpc.Core\windows_x64\
  13. xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* Grpc.Core\linux_x86\
  14. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* Grpc.Core\linux_x64\
  15. xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* Grpc.Core\macosx_x86\
  16. xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* Grpc.Core\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.Auth\Grpc.Auth.nuspec -Symbols -Version %VERSION% || goto :error
  34. %NUGET% pack Grpc.Core\Grpc.Core.nuspec -Symbols -Version %VERSION% || goto :error
  35. %NUGET% pack Grpc.HealthCheck\Grpc.HealthCheck.nuspec -Symbols -Version %VERSION_WITH_BETA% -Properties ProtobufVersion=%PROTOBUF_VERSION% || goto :error
  36. %NUGET% pack Grpc.nuspec -Version %VERSION% || goto :error
  37. %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error
  38. @rem copy resulting nuget packages to artifacts directory
  39. xcopy /Y /I *.nupkg ..\..\artifacts\
  40. @rem create a zipfile with the artifacts as well
  41. powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('..\..\artifacts', 'csharp_nugets.zip');"
  42. xcopy /Y /I csharp_nugets.zip ..\..\artifacts\
  43. goto :EOF
  44. :error
  45. echo Failed!
  46. exit /b %errorlevel%