blob: 32455683be8892dfbe2a4575ff0bac3a472363d5 [file] [log] [blame]
Jan Tattermuschf923a2d2016-01-22 14:33:53 -08001%YAML 1.2
2--- |
3 @rem Builds gRPC NuGet packages
4
5 @rem Current package versions
Craig Tillerf008f062016-02-08 12:48:03 -08006 set VERSION=${settings.csharp_version}
Jan Tattermuschf923a2d2016-01-22 14:33:53 -08007 set PROTOBUF_VERSION=3.0.0-beta2
8
9 @rem Packages that depend on prerelease packages (like Google.Protobuf) need to have prerelease suffix as well.
10 set VERSION_WITH_BETA=%VERSION%-beta
11
12 @rem Adjust the location of nuget.exe
13 set NUGET=C:\nuget\nuget.exe
14
15 @rem Collect the artifacts built by the previous build step if running on Jenkins
16 @rem TODO(jtattermusch): is there a better way to do this?
17 xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x86${"\\"}
18 xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x64${"\\"}
19 xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x86${"\\"}
20 xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x64${"\\"}
21 xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x86${"\\"}
22 xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x64${"\\"}
23
Jan Tattermusch37427032016-02-29 15:51:22 -080024 @rem Collect protoc artifacts built by the previous build step
25 xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x86${"\\"}
26 xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=windows\artifacts\* protoc_plugins\windows_x64${"\\"}
27 xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x86${"\\"}
28 xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=linux\artifacts\* protoc_plugins\linux_x64${"\\"}
29 xcopy /Y /I ..\..\architecture=x86,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x86${"\\"}
30 xcopy /Y /I ..\..\architecture=x64,language=protoc,platform=macos\artifacts\* protoc_plugins\macosx_x64${"\\"}
31
Jan Tattermuschf923a2d2016-01-22 14:33:53 -080032 @rem Fetch all dependencies
33 %%NUGET% restore ..\..\vsprojects\grpc_csharp_ext.sln || goto :error
34 %%NUGET% restore Grpc.sln || goto :error
35
36 setlocal
37
38 @call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
39
Jan Tattermusch37427032016-02-29 15:51:22 -080040 @rem We won't use the native libraries from this step, but without this Grpc.sln will fail.
Jan Tattermuschf923a2d2016-01-22 14:33:53 -080041 msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:PlatformToolset=v120 || goto :error
42
43 msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error
44
45 endlocal
46
Jan Tattermuschf923a2d2016-01-22 14:33:53 -080047 %%NUGET% pack grpc.native.csharp\grpc.native.csharp.nuspec -Version %VERSION% || goto :error
48 %%NUGET% pack Grpc.Auth\Grpc.Auth.nuspec -Symbols -Version %VERSION% || goto :error
49 %%NUGET% pack Grpc.Core\Grpc.Core.nuspec -Symbols -Version %VERSION% || goto :error
50 %%NUGET% pack Grpc.HealthCheck\Grpc.HealthCheck.nuspec -Symbols -Version %VERSION_WITH_BETA% -Properties ProtobufVersion=%PROTOBUF_VERSION% || goto :error
51 %%NUGET% pack Grpc.nuspec -Version %VERSION% || goto :error
Jan Tattermusch37427032016-02-29 15:51:22 -080052 %%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error
Jan Tattermuschf923a2d2016-01-22 14:33:53 -080053
54 @rem copy resulting nuget packages to artifacts directory
55 xcopy /Y /I *.nupkg ..\..\artifacts${"\\"}
56
Jan Tattermusch8e90ca12016-01-29 16:30:58 -080057 @rem create a zipfile with the artifacts as well
58 powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::CreateFromDirectory('..\..\artifacts', 'csharp_nugets.zip');"
Jan Tattermuschf519a692016-01-29 19:36:50 -080059 xcopy /Y /I csharp_nugets.zip ..\..\artifacts${"\\"}
Jan Tattermusch8e90ca12016-01-29 16:30:58 -080060
Jan Tattermuschf923a2d2016-01-22 14:33:53 -080061 goto :EOF
62
63 :error
64 echo Failed!
65 exit /b %errorlevel%