mirror of https://github.com/grpc/grpc.git
commit
b91d96bd57
451 changed files with 10642 additions and 2773 deletions
@ -0,0 +1,14 @@ |
||||
mergeable: |
||||
pull_requests: |
||||
label: |
||||
or: |
||||
- and: |
||||
- must_include: |
||||
regex: 'release notes: yes' |
||||
message: 'Please include release note: yes' |
||||
- must_include: |
||||
regex: '^lang\/' |
||||
message: 'Please include a language label' |
||||
- must_include: |
||||
regex: 'release notes: no' |
||||
message: 'Please include release note: no' |
@ -1,5 +1,44 @@ |
||||
workspace(name = "com_github_grpc_grpc") |
||||
workspace(name="com_github_grpc_grpc") |
||||
|
||||
load("//bazel:grpc_deps.bzl", "grpc_deps", "grpc_test_only_deps") |
||||
grpc_deps() |
||||
grpc_test_only_deps() |
||||
|
||||
new_http_archive( |
||||
name="cython", |
||||
sha256="d68138a2381afbdd0876c3cb2a22389043fa01c4badede1228ee073032b07a27", |
||||
urls=[ |
||||
"https://github.com/cython/cython/archive/c2b80d87658a8525ce091cbe146cb7eaa29fed5c.tar.gz", |
||||
], |
||||
strip_prefix="cython-c2b80d87658a8525ce091cbe146cb7eaa29fed5c", |
||||
build_file="//third_party:cython.BUILD", |
||||
) |
||||
|
||||
load("//third_party/py:python_configure.bzl", "python_configure") |
||||
python_configure(name="local_config_python") |
||||
|
||||
git_repository( |
||||
name="io_bazel_rules_python", |
||||
remote="https://github.com/bazelbuild/rules_python.git", |
||||
commit="8b5d0683a7d878b28fffe464779c8a53659fc645", |
||||
) |
||||
|
||||
load("@io_bazel_rules_python//python:pip.bzl", "pip_repositories", "pip_import") |
||||
|
||||
pip_repositories() |
||||
pip_import( |
||||
name="grpc_python_dependencies", |
||||
requirements="//:requirements.bazel.txt", |
||||
) |
||||
|
||||
load("@grpc_python_dependencies//:requirements.bzl", "pip_install") |
||||
pip_install() |
||||
|
||||
git_repository( |
||||
name="org_pubref_rules_protobuf", |
||||
remote="https://github.com/pubref/rules_protobuf", |
||||
tag="v0.8.2", |
||||
) |
||||
|
||||
load("@org_pubref_rules_protobuf//python:rules.bzl", "py_proto_repositories") |
||||
py_proto_repositories() |
||||
|
@ -0,0 +1,74 @@ |
||||
"""Custom rules for gRPC Python""" |
||||
|
||||
|
||||
# Adapted with modifications from |
||||
# tensorflow/tensorflow/core/platform/default/build_config.bzl |
||||
# Native Bazel rules don't exist yet to compile Cython code, but rules have |
||||
# been written at cython/cython and tensorflow/tensorflow. We branch from |
||||
# Tensorflow's version as it is more actively maintained and works for gRPC |
||||
# Python's needs. |
||||
def pyx_library(name, deps=[], py_deps=[], srcs=[], **kwargs): |
||||
"""Compiles a group of .pyx / .pxd / .py files. |
||||
|
||||
First runs Cython to create .cpp files for each input .pyx or .py + .pxd |
||||
pair. Then builds a shared object for each, passing "deps" to each cc_binary |
||||
rule (includes Python headers by default). Finally, creates a py_library rule |
||||
with the shared objects and any pure Python "srcs", with py_deps as its |
||||
dependencies; the shared objects can be imported like normal Python files. |
||||
|
||||
Args: |
||||
name: Name for the rule. |
||||
deps: C/C++ dependencies of the Cython (e.g. Numpy headers). |
||||
py_deps: Pure Python dependencies of the final library. |
||||
srcs: .py, .pyx, or .pxd files to either compile or pass through. |
||||
**kwargs: Extra keyword arguments passed to the py_library. |
||||
""" |
||||
# First filter out files that should be run compiled vs. passed through. |
||||
py_srcs = [] |
||||
pyx_srcs = [] |
||||
pxd_srcs = [] |
||||
for src in srcs: |
||||
if src.endswith(".pyx") or (src.endswith(".py") and |
||||
src[:-3] + ".pxd" in srcs): |
||||
pyx_srcs.append(src) |
||||
elif src.endswith(".py"): |
||||
py_srcs.append(src) |
||||
else: |
||||
pxd_srcs.append(src) |
||||
if src.endswith("__init__.py"): |
||||
pxd_srcs.append(src) |
||||
|
||||
# Invoke cython to produce the shared object libraries. |
||||
for filename in pyx_srcs: |
||||
native.genrule( |
||||
name=filename + "_cython_translation", |
||||
srcs=[filename], |
||||
outs=[filename.split(".")[0] + ".cpp"], |
||||
# Optionally use PYTHON_BIN_PATH on Linux platforms so that python 3 |
||||
# works. Windows has issues with cython_binary so skip PYTHON_BIN_PATH. |
||||
cmd= |
||||
"PYTHONHASHSEED=0 $(location @cython//:cython_binary) --cplus $(SRCS) --output-file $(OUTS)", |
||||
tools=["@cython//:cython_binary"] + pxd_srcs, |
||||
) |
||||
|
||||
shared_objects = [] |
||||
for src in pyx_srcs: |
||||
stem = src.split(".")[0] |
||||
shared_object_name = stem + ".so" |
||||
native.cc_binary( |
||||
name=shared_object_name, |
||||
srcs=[stem + ".cpp"], |
||||
deps=deps + ["@local_config_python//:python_headers"], |
||||
linkshared=1, |
||||
) |
||||
shared_objects.append(shared_object_name) |
||||
|
||||
# Now create a py_library with these shared objects as data. |
||||
native.py_library( |
||||
name=name, |
||||
srcs=py_srcs, |
||||
deps=py_deps, |
||||
srcs_version="PY2AND3", |
||||
data=shared_objects, |
||||
**kwargs) |
||||
|
@ -1,4 +1,4 @@ |
||||
set noparent |
||||
@jtattermusch |
||||
@nicolasnoble |
||||
@matt-kwong |
||||
@mehrdada |
||||
|
@ -0,0 +1,54 @@ |
||||
# gRPC C# Server Reflection |
||||
|
||||
This document shows how to use gRPC Server Reflection in gRPC C#. |
||||
Please see [C++ Server Reflection Tutorial](../server_reflection_tutorial.md) |
||||
for general information and more examples how to use server reflection. |
||||
|
||||
## Enable server reflection in C# servers |
||||
|
||||
C# Server Reflection is an add-on library. |
||||
To use it, first install the [Grpc.Reflection](https://www.nuget.org/packages/Grpc.Reflection/) |
||||
Nuget package into your project. |
||||
|
||||
Note that with C# you need to manually register the service |
||||
descriptors with the reflection service implementation when creating a server |
||||
(this isn't necessary with e.g. C++ or Java) |
||||
```csharp |
||||
// the reflection service will be aware of "Greeter" and "ServerReflection" services. |
||||
var reflectionServiceImpl = new ReflectionServiceImpl(Greeter.Descriptor, ServerReflection.Descriptor); |
||||
server = new Server() |
||||
{ |
||||
Services = |
||||
{ |
||||
// the server will serve 2 services, the Greeter and the ServerReflection |
||||
ServerReflection.BindService(new GreeterImpl()), |
||||
ServerReflection.BindService(reflectionServiceImpl) |
||||
}, |
||||
Ports = { { "localhost", 50051, ServerCredentials.Insecure } } |
||||
}; |
||||
server.Start(); |
||||
``` |
||||
|
||||
After starting the server, you can verify that the server reflection |
||||
is working properly by using the [`grpc_cli` command line |
||||
tool](https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md): |
||||
|
||||
```sh |
||||
$ grpc_cli ls localhost:50051 |
||||
``` |
||||
|
||||
output: |
||||
```sh |
||||
helloworld.Greeter |
||||
grpc.reflection.v1alpha.ServerReflection |
||||
``` |
||||
|
||||
For more examples and instructions how to use the `grpc_cli` tool, |
||||
please refer to the [`grpc_cli` documentation](../command_line_tool.md) |
||||
and the [C++ Server Reflection Tutorial](../server_reflection_tutorial.md). |
||||
|
||||
## Additional Resources |
||||
|
||||
The [Server Reflection Protocol](../server-reflection.md) provides detailed |
||||
information about how the server reflection works and describes the server reflection |
||||
protocol in detail. |
@ -0,0 +1,61 @@ |
||||
# gRPC Python Server Reflection |
||||
|
||||
This document shows how to use gRPC Server Reflection in gRPC Python. |
||||
Please see [C++ Server Reflection Tutorial](../server_reflection_tutorial.md) |
||||
for general information and more examples how to use server reflection. |
||||
|
||||
## Enable server reflection in Python servers |
||||
|
||||
gRPC Python Server Reflection is an add-on library. |
||||
To use it, first install the [grpcio-reflection](https://pypi.org/project/grpcio-reflection/) |
||||
PyPI package into your project. |
||||
|
||||
Note that with Python you need to manually register the service |
||||
descriptors with the reflection service implementation when creating a server |
||||
(this isn't necessary with e.g. C++ or Java) |
||||
```python |
||||
# add the following import statement to use server reflection |
||||
from grpc_reflection.v1alpha import reflection |
||||
# ... |
||||
def serve(): |
||||
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10)) |
||||
helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server) |
||||
# the reflection service will be aware of "Greeter" and "ServerReflection" services. |
||||
SERVICE_NAMES = ( |
||||
helloworld_pb2.DESCRIPTOR.services_by_name['Greeter'].full_name, |
||||
reflection.SERVICE_NAME, |
||||
) |
||||
reflection.enable_server_reflection(SERVICE_NAMES, server) |
||||
server.add_insecure_port('[::]:50051') |
||||
server.start() |
||||
``` |
||||
|
||||
Please see |
||||
[greeter_server_with_reflection.py](https://github.com/grpc/grpc/blob/master/examples/python/helloworld/greeter_server_with_reflection.py) |
||||
in the examples directory for the full example, which extends the gRPC [Python |
||||
`Greeter` example](https://github.com/grpc/tree/master/examples/python/helloworld) on a |
||||
reflection-enabled server. |
||||
|
||||
After starting the server, you can verify that the server reflection |
||||
is working properly by using the [`grpc_cli` command line |
||||
tool](https://github.com/grpc/grpc/blob/master/doc/command_line_tool.md): |
||||
|
||||
```sh |
||||
$ grpc_cli ls localhost:50051 |
||||
``` |
||||
|
||||
output: |
||||
```sh |
||||
grpc.reflection.v1alpha.ServerReflection |
||||
helloworld.Greeter |
||||
``` |
||||
|
||||
For more examples and instructions how to use the `grpc_cli` tool, |
||||
please refer to the [`grpc_cli` documentation](../command_line_tool.md) |
||||
and the [C++ Server Reflection Tutorial](../server_reflection_tutorial.md). |
||||
|
||||
## Additional Resources |
||||
|
||||
The [Server Reflection Protocol](../server-reflection.md) provides detailed |
||||
information about how the server reflection works and describes the server reflection |
||||
protocol in detail. |
@ -0,0 +1,36 @@ |
||||
# SSL in gRPC and performance |
||||
|
||||
The SSL requirement of gRPC isn't necessarily making it easy to integrate. The HTTP/2 protocol requires ALPN support, which is a fairly new handshake protocol only supported by recent implementations. |
||||
|
||||
As a result, we've tried hard to provide a smooth experience to our users when compiling and distributing gRPC, but this may come at performance costs due to this. More specifically, we will sometime build the SSL library by disabling assembly code |
||||
(by setting the `OPENSSL_NO_ASM` option), which can impact performance by an order of magnitude when processing encrypted streams. |
||||
|
||||
## gRPC C++: Building from Source |
||||
|
||||
Build system | Condition | Platform | Uses assembly optimizations |
||||
---|---|---|-- |
||||
Makefile | with OpenSSL 1.0.2 development files | all | :heavy_check_mark: |
||||
Makefile | all other cases | all | :x: |
||||
Bazel | | Linux | :heavy_check_mark: |
||||
Bazel | | MacOS | :heavy_check_mark: |
||||
Bazel | | Windows | :x: |
||||
CMake | boringssl from submodule (default) | all | :x: |
||||
CMake | pre-installed OpenSSL 1.0.2+ (`gRPC_SSL_PROVIDER=package`) | all | :heavy_check_mark: |
||||
|
||||
## Other Languages: Binary/Source Packages |
||||
|
||||
In addition, we are shipping packages for language implementations. These packages are source packages, but also have pre-built binaries being distributed. Building packages from source may give a different result in some cases. |
||||
|
||||
Language | From source | Platform | Uses assembly optimizations |
||||
---|---|---|--- |
||||
C# | n/a | all | :x: |
||||
Node.JS | n/a | Linux | :heavy_check_mark: |
||||
Node.JS | n/a | MacOS | :heavy_check_mark: |
||||
Node.JS | n/a | Windows | :x: |
||||
Electron | n/a | all | :heavy_check_mark: |
||||
ObjC | Yes | iOS | :x: |
||||
PHP | Yes | all | Same as the `Makefile` case from above |
||||
PHP | No | all | :x: |
||||
Python | n/a | all | :x: |
||||
Ruby | No | all | :x: |
||||
|
@ -0,0 +1,41 @@ |
||||
# Autosave files |
||||
*~ |
||||
|
||||
# build |
||||
[Oo]bj/ |
||||
[Bb]in/ |
||||
packages/ |
||||
TestResults/ |
||||
|
||||
# globs |
||||
Makefile.in |
||||
*.DS_Store |
||||
*.sln.cache |
||||
*.suo |
||||
*.cache |
||||
*.pidb |
||||
*.userprefs |
||||
*.usertasks |
||||
config.log |
||||
config.make |
||||
config.status |
||||
aclocal.m4 |
||||
install-sh |
||||
autom4te.cache/ |
||||
*.user |
||||
*.tar.gz |
||||
tarballs/ |
||||
test-results/ |
||||
Thumbs.db |
||||
.vs/ |
||||
|
||||
# Mac bundle stuff |
||||
*.dmg |
||||
*.app |
||||
|
||||
# resharper |
||||
*_Resharper.* |
||||
*.Resharper |
||||
|
||||
# dotCover |
||||
*.dotCover |
@ -0,0 +1,19 @@ |
||||
Any raw assets you want to be deployed with your application can be placed in |
||||
this directory (and child directories) and given a Build Action of "AndroidAsset". |
||||
|
||||
These files will be deployed with your package and will be accessible using Android's |
||||
AssetManager, like this: |
||||
|
||||
public class ReadAsset : Activity |
||||
{ |
||||
protected override void OnCreate (Bundle bundle) |
||||
{ |
||||
base.OnCreate (bundle); |
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt"); |
||||
} |
||||
} |
||||
|
||||
Additionally, some Android functions will automatically load asset files: |
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); |
@ -0,0 +1,83 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<ProjectGuid>{B9B0D41C-1C07-4590-A919-5865E741B2EA}</ProjectGuid> |
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>HelloworldXamarin.Droid</RootNamespace> |
||||
<AssemblyName>HelloworldXamarin.Droid</AssemblyName> |
||||
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion> |
||||
<AndroidApplication>True</AndroidApplication> |
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile> |
||||
<AndroidResgenClass>Resource</AndroidResgenClass> |
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> |
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix> |
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix> |
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>bin\Debug</OutputPath> |
||||
<DefineConstants>DEBUG;</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<AndroidLinkMode>None</AndroidLinkMode> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>bin\Release</OutputPath> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols> |
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Core" /> |
||||
<Reference Include="Mono.Android" /> |
||||
<Reference Include="System.IO.Compression" /> |
||||
<Reference Include="System.Net.Http" /> |
||||
<Reference Include="System.Runtime.Loader"> |
||||
<HintPath>..\packages\System.Runtime.Loader.4.0.0\lib\netstandard1.5\System.Runtime.Loader.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System.Interactive.Async"> |
||||
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\netstandard1.3\System.Interactive.Async.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="Grpc.Core"> |
||||
<HintPath>..\packages\Grpc.Core.1.15.0-dev\lib\netstandard1.5\Grpc.Core.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="Google.Protobuf"> |
||||
<HintPath>..\packages\Google.Protobuf.3.6.0\lib\netstandard1.0\Google.Protobuf.dll</HintPath> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="MainActivity.cs" /> |
||||
<Compile Include="Resources\Resource.designer.cs" /> |
||||
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="Resources\AboutResources.txt" /> |
||||
<None Include="Properties\AndroidManifest.xml" /> |
||||
<None Include="Assets\AboutAssets.txt" /> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<AndroidResource Include="Resources\layout\Main.axml" /> |
||||
<AndroidResource Include="Resources\values\Strings.xml" /> |
||||
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" /> |
||||
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" /> |
||||
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" /> |
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" /> |
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" /> |
||||
</ItemGroup> |
||||
<Import Project="..\HelloworldXamarin\HelloworldXamarin.projitems" Label="Shared" Condition="Exists('..\HelloworldXamarin\HelloworldXamarin.projitems')" /> |
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |
||||
<Import Project="..\packages\Grpc.Core.1.15.0-dev\build\MonoAndroid\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.15.0-dev\build\MonoAndroid\Grpc.Core.targets')" /> |
||||
</Project> |
@ -0,0 +1,44 @@ |
||||
Images, layout descriptions, binary blobs and string dictionaries can be included |
||||
in your application as resource files. Various Android APIs are designed to |
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs |
||||
directly. |
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml), |
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) |
||||
would keep its resources in the "Resources" directory of the application: |
||||
|
||||
Resources/ |
||||
drawable/ |
||||
icon.png |
||||
|
||||
layout/ |
||||
main.axml |
||||
|
||||
values/ |
||||
strings.xml |
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to |
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but |
||||
instead operate on resource IDs. When you compile an Android application that uses resources, |
||||
the build system will package the resources for distribution and generate a class called "R" |
||||
(this is an Android convention) that contains the tokens for each one of the resources |
||||
included. For example, for the above Resources layout, this is what the R class would expose: |
||||
|
||||
public class R { |
||||
public class drawable { |
||||
public const int icon = 0x123; |
||||
} |
||||
|
||||
public class layout { |
||||
public const int main = 0x456; |
||||
} |
||||
|
||||
public class strings { |
||||
public const int first_string = 0xabc; |
||||
public const int second_string = 0xbcd; |
||||
} |
||||
} |
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main |
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first |
||||
string in the dictionary file values/strings.xml. |
@ -0,0 +1,112 @@ |
||||
#pragma warning disable 1591 |
||||
//------------------------------------------------------------------------------ |
||||
// <auto-generated> |
||||
// This code was generated by a tool. |
||||
// Runtime Version:4.0.30319.42000 |
||||
// |
||||
// Changes to this file may cause incorrect behavior and will be lost if |
||||
// the code is regenerated. |
||||
// </auto-generated> |
||||
//------------------------------------------------------------------------------ |
||||
|
||||
[assembly: global::Android.Runtime.ResourceDesignerAttribute("HelloworldXamarin.Droid.Resource", IsApplication=true)] |
||||
|
||||
namespace HelloworldXamarin.Droid |
||||
{ |
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] |
||||
public partial class Resource |
||||
{ |
||||
|
||||
static Resource() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
public static void UpdateIdValues() |
||||
{ |
||||
} |
||||
|
||||
public partial class Attribute |
||||
{ |
||||
|
||||
static Attribute() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
private Attribute() |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public partial class Id |
||||
{ |
||||
|
||||
// aapt resource value: 0x7f050000 |
||||
public const int myButton = 2131034112; |
||||
|
||||
static Id() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
private Id() |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public partial class Layout |
||||
{ |
||||
|
||||
// aapt resource value: 0x7f030000 |
||||
public const int Main = 2130903040; |
||||
|
||||
static Layout() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
private Layout() |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public partial class Mipmap |
||||
{ |
||||
|
||||
// aapt resource value: 0x7f020000 |
||||
public const int Icon = 2130837504; |
||||
|
||||
static Mipmap() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
private Mipmap() |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public partial class String |
||||
{ |
||||
|
||||
// aapt resource value: 0x7f040001 |
||||
public const int app_name = 2130968577; |
||||
|
||||
// aapt resource value: 0x7f040000 |
||||
public const int hello = 2130968576; |
||||
|
||||
static String() |
||||
{ |
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues(); |
||||
} |
||||
|
||||
private String() |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
} |
||||
#pragma warning restore 1591 |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,45 @@ |
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
# Visual Studio 2012 |
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "HelloworldXamarin", "HelloworldXamarin\HelloworldXamarin.shproj", "{42FFF3D8-934F-4475-8E68-08DA340BF6E8}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloworldXamarin.Droid", "Droid\HelloworldXamarin.Droid.csproj", "{B9B0D41C-1C07-4590-A919-5865E741B2EA}" |
||||
EndProject |
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloworldXamarin.iOS", "iOS\HelloworldXamarin.iOS.csproj", "{62336DF0-60D8-478F-8140-B3CB089B417E}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
Debug|iPhoneSimulator = Debug|iPhoneSimulator |
||||
Release|iPhone = Release|iPhone |
||||
Release|iPhoneSimulator = Release|iPhoneSimulator |
||||
Debug|iPhone = Debug|iPhone |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhone.ActiveCfg = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhone.Build.0 = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.ActiveCfg = Debug|Any CPU |
||||
{B9B0D41C-1C07-4590-A919-5865E741B2EA}.Debug|iPhone.Build.0 = Debug|Any CPU |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.ActiveCfg = Release|iPhone |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|Any CPU.Build.0 = Release|iPhone |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhone.ActiveCfg = Release|iPhone |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhone.Build.0 = Release|iPhone |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.ActiveCfg = Debug|iPhone |
||||
{62336DF0-60D8-478F-8140-B3CB089B417E}.Debug|iPhone.Build.0 = Debug|iPhone |
||||
EndGlobalSection |
||||
EndGlobal |
@ -0,0 +1,286 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: helloworld.proto |
||||
#pragma warning disable 1591, 0612, 3021 |
||||
#region Designer generated code |
||||
|
||||
using pb = global::Google.Protobuf; |
||||
using pbc = global::Google.Protobuf.Collections; |
||||
using pbr = global::Google.Protobuf.Reflection; |
||||
using scg = global::System.Collections.Generic; |
||||
namespace Helloworld { |
||||
|
||||
/// <summary>Holder for reflection information generated from helloworld.proto</summary> |
||||
public static partial class HelloworldReflection { |
||||
|
||||
#region Descriptor |
||||
/// <summary>File descriptor for helloworld.proto</summary> |
||||
public static pbr::FileDescriptor Descriptor { |
||||
get { return descriptor; } |
||||
} |
||||
private static pbr::FileDescriptor descriptor; |
||||
|
||||
static HelloworldReflection() { |
||||
byte[] descriptorData = global::System.Convert.FromBase64String( |
||||
string.Concat( |
||||
"ChBoZWxsb3dvcmxkLnByb3RvEgpoZWxsb3dvcmxkIhwKDEhlbGxvUmVxdWVz", |
||||
"dBIMCgRuYW1lGAEgASgJIh0KCkhlbGxvUmVwbHkSDwoHbWVzc2FnZRgBIAEo", |
||||
"CTJJCgdHcmVldGVyEj4KCFNheUhlbGxvEhguaGVsbG93b3JsZC5IZWxsb1Jl", |
||||
"cXVlc3QaFi5oZWxsb3dvcmxkLkhlbGxvUmVwbHkiAEI2Chtpby5ncnBjLmV4", |
||||
"YW1wbGVzLmhlbGxvd29ybGRCD0hlbGxvV29ybGRQcm90b1ABogIDSExXYgZw", |
||||
"cm90bzM=")); |
||||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
||||
new pbr::FileDescriptor[] { }, |
||||
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { |
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloRequest), global::Helloworld.HelloRequest.Parser, new[]{ "Name" }, null, null, null), |
||||
new pbr::GeneratedClrTypeInfo(typeof(global::Helloworld.HelloReply), global::Helloworld.HelloReply.Parser, new[]{ "Message" }, null, null, null) |
||||
})); |
||||
} |
||||
#endregion |
||||
|
||||
} |
||||
#region Messages |
||||
/// <summary> |
||||
/// The request message containing the user's name. |
||||
/// </summary> |
||||
public sealed partial class HelloRequest : pb::IMessage<HelloRequest> { |
||||
private static readonly pb::MessageParser<HelloRequest> _parser = new pb::MessageParser<HelloRequest>(() => new HelloRequest()); |
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public static pb::MessageParser<HelloRequest> Parser { get { return _parser; } } |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public static pbr::MessageDescriptor Descriptor { |
||||
get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[0]; } |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
||||
get { return Descriptor; } |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloRequest() { |
||||
OnConstruction(); |
||||
} |
||||
|
||||
partial void OnConstruction(); |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloRequest(HelloRequest other) : this() { |
||||
name_ = other.name_; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloRequest Clone() { |
||||
return new HelloRequest(this); |
||||
} |
||||
|
||||
/// <summary>Field number for the "name" field.</summary> |
||||
public const int NameFieldNumber = 1; |
||||
private string name_ = ""; |
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public string Name { |
||||
get { return name_; } |
||||
set { |
||||
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override bool Equals(object other) { |
||||
return Equals(other as HelloRequest); |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public bool Equals(HelloRequest other) { |
||||
if (ReferenceEquals(other, null)) { |
||||
return false; |
||||
} |
||||
if (ReferenceEquals(other, this)) { |
||||
return true; |
||||
} |
||||
if (Name != other.Name) return false; |
||||
return true; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override int GetHashCode() { |
||||
int hash = 1; |
||||
if (Name.Length != 0) hash ^= Name.GetHashCode(); |
||||
return hash; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override string ToString() { |
||||
return pb::JsonFormatter.ToDiagnosticString(this); |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void WriteTo(pb::CodedOutputStream output) { |
||||
if (Name.Length != 0) { |
||||
output.WriteRawTag(10); |
||||
output.WriteString(Name); |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public int CalculateSize() { |
||||
int size = 0; |
||||
if (Name.Length != 0) { |
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); |
||||
} |
||||
return size; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void MergeFrom(HelloRequest other) { |
||||
if (other == null) { |
||||
return; |
||||
} |
||||
if (other.Name.Length != 0) { |
||||
Name = other.Name; |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void MergeFrom(pb::CodedInputStream input) { |
||||
uint tag; |
||||
while ((tag = input.ReadTag()) != 0) { |
||||
switch(tag) { |
||||
default: |
||||
input.SkipLastField(); |
||||
break; |
||||
case 10: { |
||||
Name = input.ReadString(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
/// <summary> |
||||
/// The response message containing the greetings |
||||
/// </summary> |
||||
public sealed partial class HelloReply : pb::IMessage<HelloReply> { |
||||
private static readonly pb::MessageParser<HelloReply> _parser = new pb::MessageParser<HelloReply>(() => new HelloReply()); |
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public static pb::MessageParser<HelloReply> Parser { get { return _parser; } } |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public static pbr::MessageDescriptor Descriptor { |
||||
get { return global::Helloworld.HelloworldReflection.Descriptor.MessageTypes[1]; } |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
||||
get { return Descriptor; } |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloReply() { |
||||
OnConstruction(); |
||||
} |
||||
|
||||
partial void OnConstruction(); |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloReply(HelloReply other) : this() { |
||||
message_ = other.message_; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public HelloReply Clone() { |
||||
return new HelloReply(this); |
||||
} |
||||
|
||||
/// <summary>Field number for the "message" field.</summary> |
||||
public const int MessageFieldNumber = 1; |
||||
private string message_ = ""; |
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public string Message { |
||||
get { return message_; } |
||||
set { |
||||
message_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override bool Equals(object other) { |
||||
return Equals(other as HelloReply); |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public bool Equals(HelloReply other) { |
||||
if (ReferenceEquals(other, null)) { |
||||
return false; |
||||
} |
||||
if (ReferenceEquals(other, this)) { |
||||
return true; |
||||
} |
||||
if (Message != other.Message) return false; |
||||
return true; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override int GetHashCode() { |
||||
int hash = 1; |
||||
if (Message.Length != 0) hash ^= Message.GetHashCode(); |
||||
return hash; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public override string ToString() { |
||||
return pb::JsonFormatter.ToDiagnosticString(this); |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void WriteTo(pb::CodedOutputStream output) { |
||||
if (Message.Length != 0) { |
||||
output.WriteRawTag(10); |
||||
output.WriteString(Message); |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public int CalculateSize() { |
||||
int size = 0; |
||||
if (Message.Length != 0) { |
||||
size += 1 + pb::CodedOutputStream.ComputeStringSize(Message); |
||||
} |
||||
return size; |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void MergeFrom(HelloReply other) { |
||||
if (other == null) { |
||||
return; |
||||
} |
||||
if (other.Message.Length != 0) { |
||||
Message = other.Message; |
||||
} |
||||
} |
||||
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
||||
public void MergeFrom(pb::CodedInputStream input) { |
||||
uint tag; |
||||
while ((tag = input.ReadTag()) != 0) { |
||||
switch(tag) { |
||||
default: |
||||
input.SkipLastField(); |
||||
break; |
||||
case 10: { |
||||
Message = input.ReadString(); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
#endregion |
||||
|
||||
} |
||||
|
||||
#endregion Designer generated code |
@ -0,0 +1,150 @@ |
||||
// Generated by the protocol buffer compiler. DO NOT EDIT! |
||||
// source: helloworld.proto |
||||
// Original file comments: |
||||
// Copyright 2015 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. |
||||
// |
||||
#pragma warning disable 1591 |
||||
#region Designer generated code |
||||
|
||||
using System; |
||||
using System.Threading; |
||||
using System.Threading.Tasks; |
||||
using grpc = global::Grpc.Core; |
||||
|
||||
namespace Helloworld { |
||||
/// <summary> |
||||
/// The greeting service definition. |
||||
/// </summary> |
||||
public static partial class Greeter |
||||
{ |
||||
static readonly string __ServiceName = "helloworld.Greeter"; |
||||
|
||||
static readonly grpc::Marshaller<global::Helloworld.HelloRequest> __Marshaller_HelloRequest = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloRequest.Parser.ParseFrom); |
||||
static readonly grpc::Marshaller<global::Helloworld.HelloReply> __Marshaller_HelloReply = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Helloworld.HelloReply.Parser.ParseFrom); |
||||
|
||||
static readonly grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply> __Method_SayHello = new grpc::Method<global::Helloworld.HelloRequest, global::Helloworld.HelloReply>( |
||||
grpc::MethodType.Unary, |
||||
__ServiceName, |
||||
"SayHello", |
||||
__Marshaller_HelloRequest, |
||||
__Marshaller_HelloReply); |
||||
|
||||
/// <summary>Service descriptor</summary> |
||||
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor |
||||
{ |
||||
get { return global::Helloworld.HelloworldReflection.Descriptor.Services[0]; } |
||||
} |
||||
|
||||
/// <summary>Base class for server-side implementations of Greeter</summary> |
||||
public abstract partial class GreeterBase |
||||
{ |
||||
/// <summary> |
||||
/// Sends a greeting |
||||
/// </summary> |
||||
/// <param name="request">The request received from the client.</param> |
||||
/// <param name="context">The context of the server-side call handler being invoked.</param> |
||||
/// <returns>The response to send back to the client (wrapped by a task).</returns> |
||||
public virtual global::System.Threading.Tasks.Task<global::Helloworld.HelloReply> SayHello(global::Helloworld.HelloRequest request, grpc::ServerCallContext context) |
||||
{ |
||||
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, "")); |
||||
} |
||||
|
||||
} |
||||
|
||||
/// <summary>Client for Greeter</summary> |
||||
public partial class GreeterClient : grpc::ClientBase<GreeterClient> |
||||
{ |
||||
/// <summary>Creates a new client for Greeter</summary> |
||||
/// <param name="channel">The channel to use to make remote calls.</param> |
||||
public GreeterClient(grpc::Channel channel) : base(channel) |
||||
{ |
||||
} |
||||
/// <summary>Creates a new client for Greeter that uses a custom <c>CallInvoker</c>.</summary> |
||||
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param> |
||||
public GreeterClient(grpc::CallInvoker callInvoker) : base(callInvoker) |
||||
{ |
||||
} |
||||
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary> |
||||
protected GreeterClient() : base() |
||||
{ |
||||
} |
||||
/// <summary>Protected constructor to allow creation of configured clients.</summary> |
||||
/// <param name="configuration">The client configuration.</param> |
||||
protected GreeterClient(ClientBaseConfiguration configuration) : base(configuration) |
||||
{ |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Sends a greeting |
||||
/// </summary> |
||||
/// <param name="request">The request to send to the server.</param> |
||||
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> |
||||
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> |
||||
/// <param name="cancellationToken">An optional token for canceling the call.</param> |
||||
/// <returns>The response received from the server.</returns> |
||||
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) |
||||
{ |
||||
return SayHello(request, new grpc::CallOptions(headers, deadline, cancellationToken)); |
||||
} |
||||
/// <summary> |
||||
/// Sends a greeting |
||||
/// </summary> |
||||
/// <param name="request">The request to send to the server.</param> |
||||
/// <param name="options">The options for the call.</param> |
||||
/// <returns>The response received from the server.</returns> |
||||
public virtual global::Helloworld.HelloReply SayHello(global::Helloworld.HelloRequest request, grpc::CallOptions options) |
||||
{ |
||||
return CallInvoker.BlockingUnaryCall(__Method_SayHello, null, options, request); |
||||
} |
||||
/// <summary> |
||||
/// Sends a greeting |
||||
/// </summary> |
||||
/// <param name="request">The request to send to the server.</param> |
||||
/// <param name="headers">The initial metadata to send with the call. This parameter is optional.</param> |
||||
/// <param name="deadline">An optional deadline for the call. The call will be cancelled if deadline is hit.</param> |
||||
/// <param name="cancellationToken">An optional token for canceling the call.</param> |
||||
/// <returns>The call object.</returns> |
||||
public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken)) |
||||
{ |
||||
return SayHelloAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken)); |
||||
} |
||||
/// <summary> |
||||
/// Sends a greeting |
||||
/// </summary> |
||||
/// <param name="request">The request to send to the server.</param> |
||||
/// <param name="options">The options for the call.</param> |
||||
/// <returns>The call object.</returns> |
||||
public virtual grpc::AsyncUnaryCall<global::Helloworld.HelloReply> SayHelloAsync(global::Helloworld.HelloRequest request, grpc::CallOptions options) |
||||
{ |
||||
return CallInvoker.AsyncUnaryCall(__Method_SayHello, null, options, request); |
||||
} |
||||
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary> |
||||
protected override GreeterClient NewInstance(ClientBaseConfiguration configuration) |
||||
{ |
||||
return new GreeterClient(configuration); |
||||
} |
||||
} |
||||
|
||||
/// <summary>Creates service definition that can be registered with a server</summary> |
||||
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param> |
||||
public static grpc::ServerServiceDefinition BindService(GreeterBase serviceImpl) |
||||
{ |
||||
return grpc::ServerServiceDefinition.CreateBuilder() |
||||
.AddMethod(__Method_SayHello, serviceImpl.SayHello).Build(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
#endregion |
@ -0,0 +1,15 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects> |
||||
<HasSharedItems>true</HasSharedItems> |
||||
<SharedGUID>{42FFF3D8-934F-4475-8E68-08DA340BF6E8}</SharedGUID> |
||||
</PropertyGroup> |
||||
<PropertyGroup Label="Configuration"> |
||||
<Import_RootNamespace>HelloworldXamarin</Import_RootNamespace> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Compile Include="$(MSBuildThisFileDirectory)Helloworld.cs" /> |
||||
<Compile Include="$(MSBuildThisFileDirectory)HelloworldGrpc.cs" /> |
||||
</ItemGroup> |
||||
</Project> |
@ -0,0 +1,11 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{42FFF3D8-934F-4475-8E68-08DA340BF6E8}</ProjectGuid> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" /> |
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" /> |
||||
<Import Project="HelloworldXamarin.projitems" Label="Shared" /> |
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" /> |
||||
</Project> |
@ -0,0 +1,37 @@ |
||||
gRPC C# on Xamarin |
||||
======================== |
||||
|
||||
EXPERIMENTAL ONLY |
||||
------------- |
||||
Support of the Xamarin platform is currently experimental. |
||||
The example depends on experimental Grpc.Core nuget package that hasn't |
||||
been officially released and is only available via the [daily builds](https://packages.grpc.io/) |
||||
source. |
||||
|
||||
HINT: To download the package, please manually download the latest `.nupkg` packages from "Daily Builds" in [packages.grpc.io](https://packages.grpc.io/) into a local directory. Then add a nuget source that points to that directory (That can be [done in Visual Studio](https://docs.microsoft.com/en-us/nuget/tools/package-manager-ui#package-sources) or Visual Studio for Mac via "Configure nuget sources"). After that, nuget will also explore that directory when looking for packages. |
||||
|
||||
BACKGROUND |
||||
------------- |
||||
The example project supports `Xamarin.Android` and `Xamarin.iOS`. |
||||
|
||||
For this sample, we've already generated the server and client stubs from [helloworld.proto][]. |
||||
|
||||
PREREQUISITES |
||||
------------- |
||||
|
||||
- The latest version Visual Studio 2017 or Visual Studio for Mac with Xamarin support installed. |
||||
|
||||
BUILD |
||||
------- |
||||
|
||||
- Open the `HelloworldXamarin.sln` in Visual Studio (or Visual Studio for Mac) |
||||
- Build the solution (Build -> Build All) |
||||
|
||||
Try it! |
||||
------- |
||||
|
||||
You can deploy the example apps directly through Visual Studio IDE. |
||||
Deployments can target both Android and iOS (both support physical device |
||||
deployment as well as simulator). |
||||
|
||||
[helloworld.proto]:../../protos/helloworld.proto |
@ -0,0 +1,202 @@ |
||||
{ |
||||
"images" : [ |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "20x20", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "20x20", |
||||
"scale" : "3x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "29x29", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "29x29", |
||||
"scale" : "3x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "40x40", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "40x40", |
||||
"scale" : "3x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "60x60", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "iphone", |
||||
"size" : "60x60", |
||||
"scale" : "3x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "20x20", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "20x20", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "29x29", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "29x29", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "40x40", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "40x40", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "76x76", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "76x76", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "ipad", |
||||
"size" : "83.5x83.5", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "ios-marketing", |
||||
"size" : "1024x1024", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"size" : "24x24", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "notificationCenter", |
||||
"subtype" : "38mm" |
||||
}, |
||||
{ |
||||
"size" : "27.5x27.5", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "notificationCenter", |
||||
"subtype" : "42mm" |
||||
}, |
||||
{ |
||||
"size" : "29x29", |
||||
"idiom" : "watch", |
||||
"role" : "companionSettings", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"size" : "29x29", |
||||
"idiom" : "watch", |
||||
"role" : "companionSettings", |
||||
"scale" : "3x" |
||||
}, |
||||
{ |
||||
"size" : "40x40", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "appLauncher", |
||||
"subtype" : "38mm" |
||||
}, |
||||
{ |
||||
"size" : "44x44", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "longLook", |
||||
"subtype" : "42mm" |
||||
}, |
||||
{ |
||||
"size" : "86x86", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "quickLook", |
||||
"subtype" : "38mm" |
||||
}, |
||||
{ |
||||
"size" : "98x98", |
||||
"idiom" : "watch", |
||||
"scale" : "2x", |
||||
"role" : "quickLook", |
||||
"subtype" : "42mm" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "16x16", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "16x16", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "32x32", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "32x32", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "128x128", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "128x128", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "256x256", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "256x256", |
||||
"scale" : "2x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "512x512", |
||||
"scale" : "1x" |
||||
}, |
||||
{ |
||||
"idiom" : "mac", |
||||
"size" : "512x512", |
||||
"scale" : "2x" |
||||
} |
||||
], |
||||
"info" : { |
||||
"version" : 1, |
||||
"author" : "xcode" |
||||
} |
||||
} |
@ -0,0 +1,126 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform> |
||||
<ProjectGuid>{62336DF0-60D8-478F-8140-B3CB089B417E}</ProjectGuid> |
||||
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<OutputType>Exe</OutputType> |
||||
<RootNamespace>HelloworldXamarin.iOS</RootNamespace> |
||||
<AssemblyName>HelloworldXamarin.iOS</AssemblyName> |
||||
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath> |
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<CodesignKey>iPhone Developer</CodesignKey> |
||||
<MtouchDebug>true</MtouchDebug> |
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> |
||||
<MtouchFastDev>true</MtouchFastDev> |
||||
<IOSDebuggerPort>45216</IOSDebuggerPort> |
||||
<MtouchLink>None</MtouchLink> |
||||
<MtouchArch>x86_64</MtouchArch> |
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>bin\iPhone\Release</OutputPath> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<CodesignKey>iPhone Developer</CodesignKey> |
||||
<MtouchFloat32>true</MtouchFloat32> |
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> |
||||
<MtouchLink>SdkOnly</MtouchLink> |
||||
<MtouchArch>ARM64</MtouchArch> |
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>bin\iPhoneSimulator\Release</OutputPath> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<CodesignKey>iPhone Developer</CodesignKey> |
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> |
||||
<MtouchLink>None</MtouchLink> |
||||
<MtouchArch>x86_64</MtouchArch> |
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>bin\iPhone\Debug</OutputPath> |
||||
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants> |
||||
<ErrorReport>prompt</ErrorReport> |
||||
<WarningLevel>4</WarningLevel> |
||||
<CodesignKey>iPhone Developer</CodesignKey> |
||||
<DeviceSpecificBuild>true</DeviceSpecificBuild> |
||||
<MtouchDebug>true</MtouchDebug> |
||||
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip> |
||||
<MtouchFastDev>true</MtouchFastDev> |
||||
<MtouchFloat32>true</MtouchFloat32> |
||||
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> |
||||
<IOSDebuggerPort>35164</IOSDebuggerPort> |
||||
<MtouchLink>SdkOnly</MtouchLink> |
||||
<MtouchArch>ARM64</MtouchArch> |
||||
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler> |
||||
<PlatformTarget>x86</PlatformTarget> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Core" /> |
||||
<Reference Include="Xamarin.iOS" /> |
||||
<Reference Include="System.IO.Compression" /> |
||||
<Reference Include="System.Net.Http" /> |
||||
<Reference Include="System.Runtime.Loader"> |
||||
<HintPath>..\packages\System.Runtime.Loader.4.0.0\lib\netstandard1.5\System.Runtime.Loader.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System.Interactive.Async"> |
||||
<HintPath>..\packages\System.Interactive.Async.3.1.1\lib\netstandard1.3\System.Interactive.Async.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="Grpc.Core"> |
||||
<HintPath>..\packages\Grpc.Core.1.15.0-dev\lib\netstandard1.5\Grpc.Core.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="Google.Protobuf"> |
||||
<HintPath>..\packages\Google.Protobuf.3.6.0\lib\netstandard1.0\Google.Protobuf.dll</HintPath> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" /> |
||||
<ImageAsset Include="Assets.xcassets\Contents.json" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Resources\" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<InterfaceDefinition Include="LaunchScreen.storyboard" /> |
||||
<InterfaceDefinition Include="Main.storyboard" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="Info.plist" /> |
||||
<None Include="Entitlements.plist" /> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Main.cs" /> |
||||
<Compile Include="AppDelegate.cs" /> |
||||
<Compile Include="ViewController.cs" /> |
||||
<Compile Include="ViewController.designer.cs"> |
||||
<DependentUpon>ViewController.cs</DependentUpon> |
||||
</Compile> |
||||
</ItemGroup> |
||||
<Import Project="..\HelloworldXamarin\HelloworldXamarin.projitems" Label="Shared" Condition="Exists('..\HelloworldXamarin\HelloworldXamarin.projitems')" /> |
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" /> |
||||
<Import Project="..\packages\Grpc.Core.1.15.0-dev\build\Xamarin.iOS\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.15.0-dev\build\Xamarin.iOS\Grpc.Core.targets')" /> |
||||
</Project> |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue