Merge pull request #24380 from jtattermusch/csharp_separate_xamarin

C#: Make Grpc.Core nuget slimmer by moving mobile support to Grpc.Core.Xamarin package
pull/24520/head
Jan Tattermusch 4 years ago committed by GitHub
commit ded7b3738e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/csharp/Grpc.Core.Xamarin/.gitignore
  2. 61
      src/csharp/Grpc.Core.Xamarin/Grpc.Core.Xamarin.csproj
  3. 24
      src/csharp/Grpc.Core.Xamarin/Internal.cs
  4. 0
      src/csharp/Grpc.Core.Xamarin/build/MonoAndroid10/Grpc.Core.Xamarin.targets
  5. 0
      src/csharp/Grpc.Core.Xamarin/build/Xamarin.iOS10/Grpc.Core.Xamarin.targets
  6. 28
      src/csharp/Grpc.Core/Grpc.Core.csproj
  7. 6
      src/csharp/Grpc.sln
  8. 1
      src/csharp/build_nuget.sh
  9. 6
      src/csharp/experimental/README.md

@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Grpc.Core\Common.csproj.include" />
<PropertyGroup>
<Authors>The gRPC Authors</Authors>
<Copyright>Copyright 2015 The gRPC Authors</Copyright>
<Description>Xamarin support for gRPC C#. Note that the gRPC C# support for the Xamarin platform is considered experimental.
This package contains the native grpc_csharp_ext libraries that are needed to run gRPC C# on mobile platforms (Android, iOS).
WARNING: Versions of Grpc.Core.Xamarin and Grpc.Core dependencies being used in your project must always match exactly, otherwise
things will be badly broken.</Description>
<PackageIconUrl>https://github.com/grpc/grpc.github.io/raw/master/img/grpc_square_reverse_4x.png</PackageIconUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/grpc/grpc</PackageProjectUrl>
<PackageTags>gRPC RPC HTTP/2</PackageTags>
<VersionPrefix>$(GrpcCsharpVersion)</VersionPrefix>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net45;netstandard1.5;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<Import Project="..\Grpc.Core\SourceLink.csproj.include" />
<ItemGroup>
<Content Include="..\nativelibs\csharp_ext_linux_android_armeabi-v7a\libgrpc_csharp_ext.so">
<PackagePath>native/android/armeabi-v7a/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_linux_android_arm64-v8a\libgrpc_csharp_ext.so">
<PackagePath>native/android/arm64-v8a/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_linux_android_x86\libgrpc_csharp_ext.so">
<PackagePath>native/android/x86/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_macos_ios\libgrpc_csharp_ext.a">
<PackagePath>native/ios/universal/libgrpc_csharp_ext.a</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_macos_ios\libgrpc.a">
<PackagePath>native/ios/universal/libgrpc.a</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\MonoAndroid10\Grpc.Core.Xamarin.targets">
<PackagePath>build/MonoAndroid10/</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\Xamarin.iOS10\Grpc.Core.Xamarin.targets">
<PackagePath>build/Xamarin.iOS10/</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Grpc.Core/Grpc.Core.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,24 @@
#region Copyright notice and license
// Copyright 2020 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#endregion
namespace Grpc.Core
{
// Generate an empty assembly
internal static class UnusedClass
{
}
}

@ -51,38 +51,10 @@
<PackagePath>runtimes/win/native/grpc_csharp_ext.x86.dll</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_linux_android_armeabi-v7a\libgrpc_csharp_ext.so">
<PackagePath>native/android/armeabi-v7a/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_linux_android_arm64-v8a\libgrpc_csharp_ext.so">
<PackagePath>native/android/arm64-v8a/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_linux_android_x86\libgrpc_csharp_ext.so">
<PackagePath>native/android/x86/libgrpc_csharp_ext.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_macos_ios\libgrpc_csharp_ext.a">
<PackagePath>native/ios/universal/libgrpc_csharp_ext.a</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\nativelibs\csharp_ext_macos_ios\libgrpc.a">
<PackagePath>native/ios/universal/libgrpc.a</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\net45\Grpc.Core.targets">
<PackagePath>build/net45/</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\MonoAndroid10\Grpc.Core.targets">
<PackagePath>build/MonoAndroid10/</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\Xamarin.iOS10\Grpc.Core.targets">
<PackagePath>build/Xamarin.iOS10/</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
<ItemGroup>

@ -47,6 +47,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Grpc.Tools.Tests", "Grpc.To
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.IntegrationTesting.XdsClient", "Grpc.IntegrationTesting.XdsClient\Grpc.IntegrationTesting.XdsClient.csproj", "{7306313A-4853-4CFF-B913-0FCB1A497449}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Grpc.Core.Xamarin", "Grpc.Core.Xamarin\Grpc.Core.Xamarin.csproj", "{1DCB698B-1383-4297-975A-EC8383295141}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -141,6 +143,10 @@ Global
{7306313A-4853-4CFF-B913-0FCB1A497449}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7306313A-4853-4CFF-B913-0FCB1A497449}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7306313A-4853-4CFF-B913-0FCB1A497449}.Release|Any CPU.Build.0 = Release|Any CPU
{1DCB698B-1383-4297-975A-EC8383295141}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DCB698B-1383-4297-975A-EC8383295141}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DCB698B-1383-4297-975A-EC8383295141}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DCB698B-1383-4297-975A-EC8383295141}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -47,6 +47,7 @@ dotnet pack --configuration Release Grpc.Tools --output ../../../artifacts
# rem build auxiliary packages
dotnet pack --configuration Release Grpc --output ../../../artifacts
dotnet pack --configuration Release Grpc.Core.NativeDebug --output ../../../artifacts
dotnet pack --configuration Release Grpc.Core.Xamarin --output ../../../artifacts
# Create a zipfile with all the nugets we just created
cd ../../artifacts

@ -6,6 +6,12 @@ platforms that are not yet fully supported.
gRPC C# now has experimental support for Xamarin.
See [HelloworldXamarin](/examples/csharp/HelloworldXamarin) for an example how to use it.
Starting from gRPC C# 2.34.x: in addition to the regular `Grpc.Core` dependency, you will also
need to add `Grpc.Core.Xamarin` dependency to your project (which has the mobile-specific builds of c# native extension library).
The `Grpc.Core` and `Grpc.Core.Xamarin` package versions must always match exactly for things to work.
Also note that the `Grpc.Core.Xamarin` needs to be added to your `*.Android` and `*.iOS` projects
in order for the native library bindings to be registered correctly (see https://github.com/grpc/grpc/issues/16250).
What's currently supported:
Xamarin.Android

Loading…
Cancel
Save