diff --git a/src/csharp/build_packages.bat b/src/csharp/build_packages.bat index 1930b86641209199cabfc9699b3e059ae5a030d2..6912dad2136fcba2bbae511b4df8f00036ef6148 100644 --- a/src/csharp/build_packages.bat +++ b/src/csharp/build_packages.bat @@ -11,22 +11,45 @@ set VERSION_WITH_BETA=%VERSION%-beta @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe +@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\* grpc.native.csharp\windows_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x64\ +xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x64\ +xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x86\ +xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x64\ + +@rem Fetch all dependencies +%NUGET% restore ..\..\vsprojects\grpc_csharp_ext.sln || goto :error +%NUGET% restore Grpc.sln || goto :error + setlocal -cd ..\..\vsprojects\nuget_package -@call buildall.bat || goto :error -endlocal -@call buildall.bat BUILD_SIGNED || goto :error +@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86 + +@rem We won't use the native libraries from this step, but without this Grpc.sln will fail. +msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:PlatformToolset=v120 || goto :error + +msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error -@call ..\..\vsprojects\build_plugins.bat || goto :error +endlocal + +@rem TODO(jtattermusch): re-enable protoc plugin building +@rem @call ..\..\vsprojects\build_plugins.bat || goto :error -%NUGET% pack ..\..\vsprojects\nuget_package\grpc.native.csharp.nuspec -Version %CORE_VERSION% || goto :error +%NUGET% pack grpc.native.csharp\grpc.native.csharp.nuspec -Version %CORE_VERSION% || goto :error %NUGET% pack Grpc.Auth\Grpc.Auth.nuspec -Symbols -Version %VERSION% || goto :error %NUGET% pack Grpc.Core\Grpc.Core.nuspec -Symbols -Version %VERSION% -Properties GrpcNativeCsharpVersion=%CORE_VERSION% || goto :error %NUGET% pack Grpc.HealthCheck\Grpc.HealthCheck.nuspec -Symbols -Version %VERSION_WITH_BETA% -Properties ProtobufVersion=%PROTOBUF_VERSION% || goto :error -%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error %NUGET% pack Grpc.nuspec -Version %VERSION% || goto :error +@rem TODO(jtattermusch): re-enable building Grpc.Tools package +@rem %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error + +@rem copy resulting nuget packages to artifacts directory +xcopy /Y /I *.nupkg ..\..\artifacts\ + goto :EOF :error diff --git a/src/csharp/buildall.bat b/src/csharp/buildall.bat index 08d4bdb3355c0c062f469488b16dab98105acbc1..fcc84426563ccb48661bc1082b488e65654523a1 100644 --- a/src/csharp/buildall.bat +++ b/src/csharp/buildall.bat @@ -15,10 +15,6 @@ msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:Platfor msbuild Grpc.sln /p:Configuration=Debug || goto :error msbuild Grpc.sln /p:Configuration=Release || goto :error -if "%1" == "BUILD_SIGNED" ( -msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error -) - endlocal goto :EOF diff --git a/src/csharp/grpc.native.csharp/README.md b/src/csharp/grpc.native.csharp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..77f1cb9b1f25fb63dfc06d63402e767f8dab3a53 --- /dev/null +++ b/src/csharp/grpc.native.csharp/README.md @@ -0,0 +1,22 @@ +gRPC Native Nuget package +========================= + +Prerequisites +------------- + +NuGet binary + +Building the package +-------------------- + +To build the native package, you need precompiled versions +of grpc_csharp_ext library artifacts for Windows, Linux and Mac. +In the normal gRPC release process, these are built by a Jenkins +job and they are copied to the expected location before building +the native nuget package is attempted. + +See tools/run_tests/build_artifacts.py for more details how +precompiled artifacts are built. + +When building the native NuGet package, ignore the "Assembly outside lib folder" +warnings (the DLLs are not assemblies, they are native libraries). diff --git a/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec new file mode 100644 index 0000000000000000000000000000000000000000..6a1795b7090a38b3602b4536dac84641aedd4b9b --- /dev/null +++ b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<package> + <metadata> + <id>grpc.native.csharp</id> + <version>$version$</version> + <authors>Google Inc.</authors> + <owners>grpc-packages</owners> + <licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl> + <projectUrl>http://github.com/grpc/grpc</projectUrl> + <requireLicenseAcceptance>false</requireLicenseAcceptance> + <description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description> + <releaseNotes>Release of gRPC C core $version$ libraries.</releaseNotes> + <copyright>Copyright 2015-2016</copyright> + <title>gRPC C# Native Extension</title> + <summary>Native library required by gRPC C#</summary> + <tags>gRPC native</tags> + </metadata> + <files> + <file src="grpc.native.csharp.targets" target="\build\portable-net45+netcore45+wpa81+wp8\grpc.native.csharp.targets" /> + <file src="windows_x86/grpc_csharp_ext.dll" target="/build/native/bin/windows_x86/grpc_csharp_ext.dll" /> + <file src="windows_x64/grpc_csharp_ext.dll" target="/build/native/bin/windows_x64/grpc_csharp_ext.dll" /> + <file src="linux_x86/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x86/libgrpc_csharp_ext.so" /> + <file src="linux_x64/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x64/libgrpc_csharp_ext.so" /> + <file src="macosx_x86/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x86/libgrpc_csharp_ext.dylib" /> + <file src="macosx_x64/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x64/libgrpc_csharp_ext.dylib" /> + </files> +</package> diff --git a/src/csharp/grpc.native.csharp/grpc.native.csharp.targets b/src/csharp/grpc.native.csharp/grpc.native.csharp.targets new file mode 100644 index 0000000000000000000000000000000000000000..501fc5054827ac0eb9994f3bcd098cb2182cc3ca --- /dev/null +++ b/src/csharp/grpc.native.csharp/grpc.native.csharp.targets @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\windows_x86\grpc_csharp_ext.dll"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\windows_x86\grpc_csharp_ext.dll</Link> + </Content> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\windows_x64\grpc_csharp_ext.dll"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\windows_x64\grpc_csharp_ext.dll</Link> + </Content> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\linux_x86\libgrpc_csharp_ext.so"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\linux_x86\libgrpc_csharp_ext.so</Link> + </Content> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\linux_x64\libgrpc_csharp_ext.so"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\linux_x64\libgrpc_csharp_ext.so</Link> + </Content> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\macosx_x86\libgrpc_csharp_ext.dylib"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\macosx_x86\libgrpc_csharp_ext.dylib</Link> + </Content> + <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\macosx_x64\libgrpc_csharp_ext.dylib"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + <Link>nativelibs\macosx_x64\libgrpc_csharp_ext.dylib</Link> + </Content> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/vsprojects/nuget_package/.gitignore b/vsprojects/nuget_package/.gitignore deleted file mode 100644 index ae830da1b219d6fc7a7bcc2f5ac175ab9218efc3..0000000000000000000000000000000000000000 --- a/vsprojects/nuget_package/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/tmp -/output -*.nupkg diff --git a/vsprojects/nuget_package/README.md b/vsprojects/nuget_package/README.md deleted file mode 100644 index 58573f76d4638d075def0ee61d88ff30d265a3eb..0000000000000000000000000000000000000000 --- a/vsprojects/nuget_package/README.md +++ /dev/null @@ -1,23 +0,0 @@ -gRPC Native Nuget package -========================= - -Prerequisites -------------- -Multiple versions of VS installed to be able to build all the targets: -* Visual Studio 2015 -* Visual Studio 2013 -* Visual Studio 2010 (you might need SP1 to prevent LNK1123 error) - -NuGet binary - -Building the package --------------------- - -Build all flavors of gRPC C# extension and package them as a NuGet package. -``` -buildall.bat - -nuget pack grpc.native.csharp.nuspec -``` - -When building the NuGet package, ignore the "Assembly outside lib folder" warnings (they DLLs are not assemblies, they are native libraries). diff --git a/vsprojects/nuget_package/buildall.bat b/vsprojects/nuget_package/buildall.bat deleted file mode 100644 index e6cd0ac421da40d3f61482648e6eae120c96f221..0000000000000000000000000000000000000000 --- a/vsprojects/nuget_package/buildall.bat +++ /dev/null @@ -1,31 +0,0 @@ -@echo off - -setlocal -call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 -call :build x64 Release v140 || goto :eof -call :build x64 Debug v140 || goto :eof -endlocal - -setlocal -call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 -call :build Win32 Release v140 || goto :eof -call :build Win32 Debug v140 || goto :eof -endlocal - -setlocal -call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 -call :build x64 Release v120 || goto :eof -call :build x64 Debug v120 || goto :eof -endlocal - -setlocal -call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 -call :build Win32 Release v120 || goto :eof -call :build Win32 Debug v120 || goto :eof -endlocal - -goto :eof - -:build -msbuild /P:Platform=%1 /P:Configuration=%2 /P:PlatformToolset=%3 /P:OutDir=..\..\nuget_package\output\%3\%1\%2\ /P:IntDir=..\..\nuget_package\tmp\%3\%1\%2\ ..\grpc_csharp_ext.sln || goto :eof -goto :eof diff --git a/vsprojects/nuget_package/grpc.native.csharp.nuspec b/vsprojects/nuget_package/grpc.native.csharp.nuspec deleted file mode 100644 index 72b9a79d89626d72aff26b5da70e5b2f08c38ba4..0000000000000000000000000000000000000000 --- a/vsprojects/nuget_package/grpc.native.csharp.nuspec +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<package> - <metadata> - <id>grpc.native.csharp</id> - <version>$version$</version> - <authors>Google Inc.</authors> - <owners>grpc-packages</owners> - <licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl> - <projectUrl>http://github.com/grpc/grpc</projectUrl> - <requireLicenseAcceptance>false</requireLicenseAcceptance> - <description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description> - <releaseNotes>Release of gRPC C core $version$ libraries.</releaseNotes> - <copyright>Copyright 2015</copyright> - <title>gRPC C# Native Extension</title> - <summary>Native library required by gRPC C#</summary> - <tags>gRPC native</tags> - </metadata> - <files> - <file src="grpc.native.csharp.targets" target="\build\portable-net45+netcore45+wpa81+wp8\grpc.native.csharp.targets" /> - - <!-- VS 2013 --> - <file src="output\v120\Win32\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v120\Win32\Debug\grpc_csharp_ext.dll" /> - <file src="output\v120\Win32\Release\grpc_csharp_ext.dll" target="/build/native/bin/v120\Win32\Release\grpc_csharp_ext.dll" /> - <file src="output\v120\x64\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v120\x64\Debug\grpc_csharp_ext.dll" /> - <file src="output\v120\x64\Release\grpc_csharp_ext.dll" target="/build/native/bin/v120\x64\Release\grpc_csharp_ext.dll" /> - <!-- VS 2015 --> - <file src="output\v140\Win32\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v140\Win32\Debug\grpc_csharp_ext.dll" /> - <file src="output\v140\Win32\Release\grpc_csharp_ext.dll" target="/build/native/bin/v140\Win32\Release\grpc_csharp_ext.dll" /> - <file src="output\v140\x64\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v140\x64\Debug\grpc_csharp_ext.dll" /> - <file src="output\v140\x64\Release\grpc_csharp_ext.dll" target="/build/native/bin/v140\x64\Release\grpc_csharp_ext.dll" /> - </files> -</package> diff --git a/vsprojects/nuget_package/grpc.native.csharp.targets b/vsprojects/nuget_package/grpc.native.csharp.targets deleted file mode 100644 index e59215b835ad9cf943a88a2a4d554fcd77c187f9..0000000000000000000000000000000000000000 --- a/vsprojects/nuget_package/grpc.native.csharp.targets +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <!-- - Whether or not to copy native dependencies to output directory as part of build. - If not explicitly specified in the project file, this defaults to true on Windows - and false on Unix systems. - --> - <CopyNativeDependencies Condition=" '$(CopyNativeDependencies)' == '' And '$(OS)' != 'Unix' ">true</CopyNativeDependencies> - <CopyNativeDependencies Condition=" '$(CopyNativeDependencies)' == '' And '$(OS)' == 'Unix' ">false</CopyNativeDependencies> - - <!-- - Select which platform toolset of native dependencies to use based on VS version (v120 is the default). - Value can be explicitly specified in the project file. - --> - <NativeDependenciesToolset Condition=" '$(NativeDependenciesToolset)' == '' And '$(VisualStudioVersion)' == '14.0' ">v140</NativeDependenciesToolset> - <NativeDependenciesToolset Condition=" '$(NativeDependenciesToolset)' == '' And '$(VisualStudioVersion)' == '10.0' ">v100</NativeDependenciesToolset> - <NativeDependenciesToolset Condition=" '$(NativeDependenciesToolset)' == '' ">v120</NativeDependenciesToolset> - - <!-- Select which platform of native dependencies to use. Value can be explicitly specified in the project file. --> - <NativeDependenciesPlatform Condition=" '$(NativeDependenciesPlatform)' == '' ">Win32</NativeDependenciesPlatform> - - <!-- - Select which configuration of native dependencies to use. Uses release build if project configuration is Release, - otherwise defaults to Debug. Value can be explicitly specified in the project file. - --> - <NativeDependenciesConfiguration Condition=" '$(NativeDependenciesConfiguration)' == '' And '$(Configuration)' == 'Release' ">Release</NativeDependenciesConfiguration> - <NativeDependenciesConfiguration Condition=" '$(NativeDependenciesConfiguration)' == '' ">Debug</NativeDependenciesConfiguration> - </PropertyGroup> - <Choose> - <!-- Under older versions of Monodevelop, Choose is not supported and is just ignored, which gives us the desired effect. --> - <When Condition=" '$(CopyNativeDependencies)' == 'true' "> - <ItemGroup> - <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\$(NativeDependenciesToolset)\$(NativeDependenciesPlatform)\$(NativeDependenciesConfiguration)\grpc_csharp_ext.dll"> - <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> - </Content> - </ItemGroup> - </When> - <Otherwise /> - </Choose> -</Project> \ No newline at end of file