diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 4a21b5b547ccce9059b42e0846a95856540f3594..dcba4d433d5b42e3c97fbe9c619138702cf0f47e 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -73,7 +73,7 @@ static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { static __inline int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG) p, + return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG *) p, (LONGLONG) n, (LONGLONG) o); #else return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 0bb3e16c8d106abb136e15a0a2ef5b0fefa12365..73eedddf44560bc4dd827f79a1e199241d1402a2 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -45,8 +45,10 @@ #define GPR_WINSOCK_SOCKET 1 #ifdef __GNUC__ #define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 #else #define GPR_WIN32_ATOMIC 1 +#define GPR_MSVC_TLS 1 #endif #elif defined(_WIN32) || defined(WIN32) #define GPR_ARCH_32 1 diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index aec626509aa611bd6d622990af9dc745749d7996..7968729353a1ec1185b3fd61454ecb3629b8a841 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -78,7 +78,6 @@ static void do_iocp_work() { if (overlapped == &g_iocp_custom_overlap) { if (completion_key == (ULONG_PTR) &g_iocp_kick_token) { /* We were awoken from a kick. */ - gpr_log(GPR_DEBUG, "do_iocp_work - got a kick"); return; } gpr_log(GPR_ERROR, "Unknown custom completion key."); @@ -87,10 +86,8 @@ static void do_iocp_work() { socket = (grpc_winsocket*) completion_key; if (overlapped == &socket->write_info.overlapped) { - gpr_log(GPR_DEBUG, "do_iocp_work - got write packet"); info = &socket->write_info; } else if (overlapped == &socket->read_info.overlapped) { - gpr_log(GPR_DEBUG, "do_iocp_work - got read packet"); info = &socket->read_info; } else { gpr_log(GPR_ERROR, "Unknown IOCP operation"); @@ -98,8 +95,6 @@ static void do_iocp_work() { } success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes, FALSE, &flags); - gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s %s", bytes, flags, - success ? "succeeded" : "failed", socket->orphan ? "orphan" : ""); if (socket->orphan) { grpc_winsocket_destroy(socket); gpr_atm_full_fetch_add(&g_orphans, -1); @@ -189,11 +184,9 @@ static void socket_notify_on_iocp(grpc_winsocket *socket, if (info->has_pending_iocp) { run_now = 1; info->has_pending_iocp = 0; - gpr_log(GPR_DEBUG, "socket_notify_on_iocp - runs now"); } else { info->cb = cb; info->opaque = opaque; - gpr_log(GPR_DEBUG, "socket_notify_on_iocp - queued"); } gpr_mu_unlock(&socket->state_mu); if (run_now) cb(opaque, 1); @@ -201,13 +194,11 @@ static void socket_notify_on_iocp(grpc_winsocket *socket, void grpc_socket_notify_on_write(grpc_winsocket *socket, void(*cb)(void *, int), void *opaque) { - gpr_log(GPR_DEBUG, "grpc_socket_notify_on_write"); socket_notify_on_iocp(socket, cb, opaque, &socket->write_info); } void grpc_socket_notify_on_read(grpc_winsocket *socket, void(*cb)(void *, int), void *opaque) { - gpr_log(GPR_DEBUG, "grpc_socket_notify_on_read"); socket_notify_on_iocp(socket, cb, opaque, &socket->read_info); } diff --git a/src/core/iomgr/resolve_address_windows.c b/src/core/iomgr/resolve_address_windows.c index 877b3f35ed879d259c3e31b835a95a99a75d880b..ac31dadd9d78faae8fca27433b6f4b4c512d007d 100644 --- a/src/core/iomgr/resolve_address_windows.c +++ b/src/core/iomgr/resolve_address_windows.c @@ -107,18 +107,14 @@ grpc_resolved_addresses *grpc_blocking_resolve_address( i++; } - /* Temporary logging, to help identify flakiness in dualstack_socket_test. */ { const gpr_timespec delay = gpr_time_sub(gpr_now(), start_time); const int delay_ms = delay.tv_sec * GPR_MS_PER_SEC + delay.tv_nsec / GPR_NS_PER_MS; - gpr_log(GPR_INFO, "logspam: getaddrinfo(%s, %s) resolved %d addrs in %dms:", - host, port, addrs->naddrs, delay_ms); for (i = 0; i < addrs->naddrs; i++) { char *buf; grpc_sockaddr_to_string(&buf, (struct sockaddr *)&addrs->addrs[i].addr, 0); - gpr_log(GPR_INFO, "logspam: [%d] %s", i, buf); gpr_free(buf); } } diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index 22dad41783fd2f4a908d90a544e8aa3e57f083f7..91268c04e6dba7cd4e05db8aaefef42ced0c87e8 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -46,7 +46,6 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket) { grpc_winsocket *r = gpr_malloc(sizeof(grpc_winsocket)); - gpr_log(GPR_DEBUG, "grpc_winsocket_create"); memset(r, 0, sizeof(grpc_winsocket)); r->socket = socket; gpr_mu_init(&r->state_mu); @@ -61,13 +60,11 @@ static void shutdown_op(grpc_winsocket_callback_info *info) { } void grpc_winsocket_shutdown(grpc_winsocket *socket) { - gpr_log(GPR_DEBUG, "grpc_winsocket_shutdown"); shutdown_op(&socket->read_info); shutdown_op(&socket->write_info); } void grpc_winsocket_orphan(grpc_winsocket *socket) { - gpr_log(GPR_DEBUG, "grpc_winsocket_orphan"); grpc_iocp_socket_orphan(socket); socket->orphan = 1; grpc_iomgr_unref(); diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index 181d89cb6d3c019bb1847df367a2b286c7f1a462..00c8da601b4e42f907403a6309b033cef3d0bc2b 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -102,7 +102,6 @@ static void on_connect(void *acp, int success) { gpr_free(utf8_message); goto finish; } else { - gpr_log(GPR_DEBUG, "on_connect: connection established"); ep = grpc_tcp_create(ac->socket); goto finish; } @@ -179,9 +178,7 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), info = &socket->write_info; success = ConnectEx(sock, addr, addr_len, NULL, 0, NULL, &info->overlapped); - if (success) { - gpr_log(GPR_DEBUG, "connected immediately - but we still go to sleep"); - } else { + if (!success) { int error = WSAGetLastError(); if (error != ERROR_IO_PENDING) { message = "ConnectEx failed: %s"; @@ -189,7 +186,6 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), } } - gpr_log(GPR_DEBUG, "grpc_tcp_client_connect: connection pending"); ac = gpr_malloc(sizeof(async_connect)); ac->cb = cb; ac->cb_arg = arg; diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index a43d5670a41068a93ac3df5ce670cbfcabf2a4b8..6e10da97ccb5cf4656952a18b0932275dc599965 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -191,13 +191,13 @@ static void start_accept(server_port *port) { goto failure; } + /* TODO(jtattermusch): probably a race here, we regularly get use-after-free on server shutdown */ + GPR_ASSERT(port->socket != 0xfeeefeee); success = port->AcceptEx(port->socket->socket, sock, port->addresses, 0, addrlen, addrlen, &bytes_received, &port->socket->read_info.overlapped); - if (success) { - gpr_log(GPR_DEBUG, "accepted immediately - but we still go to sleep"); - } else { + if (!success) { int error = WSAGetLastError(); if (error != ERROR_IO_PENDING) { message = "AcceptEx failed: %s"; @@ -234,11 +234,9 @@ static void on_accept(void *arg, int success) { gpr_free(utf8_message); closesocket(sock); } else { - gpr_log(GPR_DEBUG, "on_accept: accepted connection"); ep = grpc_tcp_create(grpc_winsocket_create(sock)); } } else { - gpr_log(GPR_DEBUG, "on_accept: shutting down"); closesocket(sock); gpr_mu_lock(&sp->server->mu); if (0 == --sp->server->active_ports) { @@ -248,7 +246,9 @@ static void on_accept(void *arg, int success) { } if (ep) sp->server->cb(sp->server->cb_arg, ep); - start_accept(sp); + if (success) { + start_accept(sp); + } } static int add_socket_to_server(grpc_tcp_server *s, SOCKET sock, diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index ec5496e7eef05cad5306291fea634cbf96cda9cf..71534eaa3df0e34ac03e7b2d8536d3c6b0e326eb 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -93,14 +93,11 @@ typedef struct grpc_tcp { } grpc_tcp; static void tcp_ref(grpc_tcp *tcp) { - gpr_log(GPR_DEBUG, "tcp_ref"); gpr_ref(&tcp->refcount); } static void tcp_unref(grpc_tcp *tcp) { - gpr_log(GPR_DEBUG, "tcp_unref"); if (gpr_unref(&tcp->refcount)) { - gpr_log(GPR_DEBUG, "tcp_unref: destroying"); gpr_slice_buffer_destroy(&tcp->write_slices); grpc_winsocket_orphan(tcp->socket); gpr_free(tcp); @@ -126,24 +123,20 @@ static void on_read(void *tcpp, int success) { return; } - gpr_log(GPR_DEBUG, "on_read"); tcp->outstanding_read = 0; if (socket->read_info.wsa_error != 0) { char *utf8_message = gpr_format_message(info->wsa_error); - __debugbreak(); gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); gpr_free(utf8_message); status = GRPC_ENDPOINT_CB_ERROR; } else { if (info->bytes_transfered != 0) { sub = gpr_slice_sub(tcp->read_slice, 0, info->bytes_transfered); - gpr_log(GPR_DEBUG, "on_read: calling callback"); status = GRPC_ENDPOINT_CB_OK; slice = ⊂ nslices = 1; } else { - gpr_log(GPR_DEBUG, "on_read: closed socket"); gpr_slice_unref(tcp->read_slice); status = GRPC_ENDPOINT_CB_EOF; } @@ -174,27 +167,22 @@ static void win_notify_on_read(grpc_endpoint *ep, buffer.len = GPR_SLICE_LENGTH(tcp->read_slice); buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice); - gpr_log(GPR_DEBUG, "win_notify_on_read: calling WSARecv without overlap"); status = WSARecv(tcp->socket->socket, &buffer, 1, &bytes_read, &flags, NULL, NULL); info->wsa_error = status == 0 ? 0 : WSAGetLastError(); if (info->wsa_error != WSAEWOULDBLOCK) { - gpr_log(GPR_DEBUG, "got response immediately, calling on_read"); info->bytes_transfered = bytes_read; /* This might heavily recurse. */ on_read(tcp, 1); return; } - gpr_log(GPR_DEBUG, "got WSAEWOULDBLOCK - calling WSARecv with overlap"); - memset(&tcp->socket->read_info.overlapped, 0, sizeof(OVERLAPPED)); status = WSARecv(tcp->socket->socket, &buffer, 1, &bytes_read, &flags, &info->overlapped, NULL); if (status == 0) { - gpr_log(GPR_DEBUG, "got response immediately, but we're going to sleep"); grpc_socket_notify_on_read(tcp->socket, on_read, tcp); return; } @@ -213,7 +201,6 @@ static void win_notify_on_read(grpc_endpoint *ep, return; } - gpr_log(GPR_DEBUG, "waiting on the IO completion port now"); grpc_socket_notify_on_read(tcp->socket, on_read, tcp); } @@ -227,8 +214,6 @@ static void on_write(void *tcpp, int success) { GPR_ASSERT(tcp->outstanding_write); - gpr_log(GPR_DEBUG, "on_write"); - if (!success) { tcp_unref(tcp); cb(opaque, GRPC_ENDPOINT_CB_SHUTDOWN); @@ -265,13 +250,9 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, WSABUF *allocated = NULL; WSABUF *buffers = local_buffers; - GPR_ASSERT(nslices != 0); - GPR_ASSERT(GPR_SLICE_LENGTH(slices[0]) != 0); GPR_ASSERT(!tcp->outstanding_write); tcp_ref(tcp); - gpr_log(GPR_DEBUG, "win_write"); - tcp->outstanding_write = 1; tcp->write_cb = cb; tcp->write_user_data = arg; @@ -287,14 +268,12 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices.slices[i]); } - gpr_log(GPR_DEBUG, "win_write: calling WSASend without overlap"); status = WSASend(socket->socket, buffers, tcp->write_slices.count, &bytes_sent, 0, NULL, NULL); info->wsa_error = status == 0 ? 0 : WSAGetLastError(); if (info->wsa_error != WSAEWOULDBLOCK) { grpc_endpoint_write_status ret = GRPC_ENDPOINT_WRITE_ERROR; - gpr_log(GPR_DEBUG, "got response immediately, cleaning up and leaving"); if (status == 0) { ret = GRPC_ENDPOINT_WRITE_DONE; GPR_ASSERT(bytes_sent == tcp->write_slices.length); @@ -310,8 +289,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, return ret; } - gpr_log(GPR_DEBUG, "got WSAEWOULDBLOCK - calling WSASend with overlap"); - memset(&socket->write_info, 0, sizeof(OVERLAPPED)); status = WSASend(socket->socket, buffers, tcp->write_slices.count, &bytes_sent, 0, &socket->write_info.overlapped, NULL); @@ -329,9 +306,6 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, tcp_unref(tcp); return GRPC_ENDPOINT_WRITE_ERROR; } - gpr_log(GPR_DEBUG, "win_write: got pending op"); - } else { - gpr_log(GPR_DEBUG, "wrote data immediately - but we're going to sleep"); } grpc_socket_notify_on_write(socket, on_write, tcp); @@ -340,19 +314,16 @@ static grpc_endpoint_write_status win_write(grpc_endpoint *ep, static void win_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_add_to_pollset"); grpc_iocp_add_socket(tcp->socket); } static void win_shutdown(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_shutdown"); grpc_winsocket_shutdown(tcp->socket); } static void win_destroy(grpc_endpoint *ep) { grpc_tcp *tcp = (grpc_tcp *) ep; - gpr_log(GPR_DEBUG, "win_destroy"); tcp_unref(tcp); } diff --git a/src/csharp/Grpc.Core/.gitignore b/src/csharp/Grpc.Core/.gitignore index 8d4a6c08a83aaa5470f3c556faf2988be0ed1288..c2dd6641675ac03d8a7e5d6af6f03637ef4cd137 100644 --- a/src/csharp/Grpc.Core/.gitignore +++ b/src/csharp/Grpc.Core/.gitignore @@ -1,2 +1,3 @@ bin -obj \ No newline at end of file +obj +*.nupkg diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index b4b42dfbf5b7170797211d2e8a0b78f8a10e37de..b612512b03c1257249192e37452351c394ade422 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -34,8 +34,9 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> - <Reference Include="System.Collections.Immutable"> - <HintPath>..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> + <Reference Include="System.Collections.Immutable, Version=1.0.34.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Core/Grpc.Core.nuspec b/src/csharp/Grpc.Core/Grpc.Core.nuspec index f2032522c906ac6e2f47d3685978d54cfe6b4de0..4865ead555efc25cbd6e2ff71fa51981c5932534 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.nuspec +++ b/src/csharp/Grpc.Core/Grpc.Core.nuspec @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<package > +<package> <metadata> <id>Grpc.Core</id> <title>gRPC Core</title> @@ -7,7 +7,7 @@ <description>Core C# implementation of gRPC - an RPC library and framework. See project site for more info. This is an experimental release, not ready to use. </description> - <version>0.2.0</version> + <version>0.2.1</version> <authors>Google Inc.</authors> <owners>jtattermusch</owners> <licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl> @@ -16,6 +16,10 @@ <releaseNotes>The first experimental release. Not ready to use.</releaseNotes> <copyright>Copyright 2015, Google Inc.</copyright> <tags>gRPC RPC Protocol HTTP/2</tags> + <dependencies> + <dependency id="Microsoft.Bcl.Immutable" version="1.0.34" /> + <dependency id="grpc.native.csharp_ext" version="0.6.0.0" /> + </dependencies> </metadata> <files> <file src="bin/Release/Grpc.Core.dll" target="lib/net45" /> diff --git a/src/csharp/Grpc.Core/packages.config b/src/csharp/Grpc.Core/packages.config index 669c1dc625c13ce862ee470f7c6e7b4cce2e852c..71967de56e5d9b42ebe2c2911e5b21e9d5fd7ccc 100644 --- a/src/csharp/Grpc.Core/packages.config +++ b/src/csharp/Grpc.Core/packages.config @@ -2,5 +2,5 @@ <packages> <package id="grpc.dependencies.openssl.redist" version="1.0.2.2" targetFramework="net45" /> <package id="grpc.dependencies.zlib.redist" version="1.2.8.9" targetFramework="net45" /> - <package id="System.Collections.Immutable" version="1.1.34-rc" targetFramework="net45" /> + <package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net45" /> </packages> \ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index c3e5f03074a65488ba87194b55511783be430fc5..584bf1068de88e688acab3b3a8cf93d2606d2e51 100644 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -39,8 +39,9 @@ <Reference Include="Google.ProtocolBuffers"> <HintPath>..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll</HintPath> </Reference> - <Reference Include="System.Collections.Immutable"> - <HintPath>..\packages\System.Collections.Immutable.1.1.34-rc\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> + <Reference Include="System.Collections.Immutable, Version=1.0.34.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\Microsoft.Bcl.Immutable.1.0.34\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config index 157c264eac0bd9c9f341180bfc099973aa4382f2..335f829432d294df41ab545f93a46e22ae433e9a 100644 --- a/src/csharp/Grpc.IntegrationTesting/packages.config +++ b/src/csharp/Grpc.IntegrationTesting/packages.config @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="Google.ProtocolBuffers" version="2.4.1.521" targetFramework="net45" /> + <package id="Microsoft.Bcl.Immutable" version="1.0.34" targetFramework="net45" /> <package id="NUnit" version="2.6.4" targetFramework="net45" /> - <package id="System.Collections.Immutable" version="1.1.34-rc" targetFramework="net45" /> </packages> \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index 848627ff547e17d01fa99484447af6ebec8cfa38..31bd4eb821670ce2814cd02da7188c8ef59e2ead 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -2,6 +2,7 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../../.." +pod 'Route_guide', :path => "protos" link_with 'Sample', 'SampleTests' diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index bf0b3642b13e98ebf145a55b4666b592578fe3e1..ca5e302a17453aa37284200baafb92534fb73eab 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -38,6 +38,7 @@ #import <gRPC/GRPCMethodName.h> #import <gRPC/GRXWriter+Immediate.h> #import <gRPC/GRXWriteable.h> +#import <Route_guide/Route_guide.pb.h> @interface SampleTests : XCTestCase @end @@ -101,4 +102,38 @@ [self waitForExpectationsWithTimeout:2.0 handler:nil]; } + +- (void)testSimpleProtoRPC { + __weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; + __weak XCTestExpectation *expectedResponse = + [self expectationWithDescription:@"Expected response."]; + __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; + + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" + interface:@"RouteGuide" + method:@"GetFeature"]; + + RGDPoint *point = [[[[[RGDPointBuilder alloc] init] setLatitude:28E7] setLongitude:-15E7] build]; + id<GRXWriter> requestsWriter = [GRXWriter writerWithValue:[point data]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"127.0.0.1:8980" + method:method + requestsWriter:requestsWriter]; + + id<GRXWriteable> responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + XCTAssertNotNil(value, @"nil value received as response."); + [response fulfill]; + RGDFeature *feature = [RGDFeature parseFromData:value]; + XCTAssertEqualObjects(point, feature.location); + XCTAssertNotNil(feature.name, @"Response's name is nil."); + [expectedResponse fulfill]; + } completionHandler:^(NSError *errorOrNil) { + XCTAssertNil(errorOrNil, @"Finished with unexpected error: %@", errorOrNil); + [completion fulfill]; + }]; + + [call startWithWriteable:responsesWriteable]; + + [self waitForExpectationsWithTimeout:2.0 handler:nil]; +} @end diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.h b/src/objective-c/examples/Sample/protos/Route_guide.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..194bfc5f2ae84cc8f3f2d0462ee3bfee751e3401 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.h @@ -0,0 +1,387 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import <ProtocolBuffers/ProtocolBuffers.h> + +// @@protoc_insertion_point(imports) + +@class ObjectiveCFileOptions; +@class ObjectiveCFileOptionsBuilder; +@class PBDescriptorProto; +@class PBDescriptorProtoBuilder; +@class PBDescriptorProtoExtensionRange; +@class PBDescriptorProtoExtensionRangeBuilder; +@class PBEnumDescriptorProto; +@class PBEnumDescriptorProtoBuilder; +@class PBEnumOptions; +@class PBEnumOptionsBuilder; +@class PBEnumValueDescriptorProto; +@class PBEnumValueDescriptorProtoBuilder; +@class PBEnumValueOptions; +@class PBEnumValueOptionsBuilder; +@class PBFieldDescriptorProto; +@class PBFieldDescriptorProtoBuilder; +@class PBFieldOptions; +@class PBFieldOptionsBuilder; +@class PBFileDescriptorProto; +@class PBFileDescriptorProtoBuilder; +@class PBFileDescriptorSet; +@class PBFileDescriptorSetBuilder; +@class PBFileOptions; +@class PBFileOptionsBuilder; +@class PBMessageOptions; +@class PBMessageOptionsBuilder; +@class PBMethodDescriptorProto; +@class PBMethodDescriptorProtoBuilder; +@class PBMethodOptions; +@class PBMethodOptionsBuilder; +@class PBOneofDescriptorProto; +@class PBOneofDescriptorProtoBuilder; +@class PBServiceDescriptorProto; +@class PBServiceDescriptorProtoBuilder; +@class PBServiceOptions; +@class PBServiceOptionsBuilder; +@class PBSourceCodeInfo; +@class PBSourceCodeInfoBuilder; +@class PBSourceCodeInfoLocation; +@class PBSourceCodeInfoLocationBuilder; +@class PBUninterpretedOption; +@class PBUninterpretedOptionBuilder; +@class PBUninterpretedOptionNamePart; +@class PBUninterpretedOptionNamePartBuilder; +@class RGDFeature; +@class RGDFeatureBuilder; +@class RGDPoint; +@class RGDPointBuilder; +@class RGDRectangle; +@class RGDRectangleBuilder; +@class RGDRouteNote; +@class RGDRouteNoteBuilder; +@class RGDRouteSummary; +@class RGDRouteSummaryBuilder; + + + +@interface RGDRouteGuideRoot : NSObject { +} ++ (PBExtensionRegistry*) extensionRegistry; ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; +@end + +@interface RGDPoint : PBGeneratedMessage<GeneratedMessageProtocol> { +@private + BOOL hasLatitude_:1; + BOOL hasLongitude_:1; + SInt32 latitude; + SInt32 longitude; +} +- (BOOL) hasLatitude; +- (BOOL) hasLongitude; +@property (readonly) SInt32 latitude; +@property (readonly) SInt32 longitude; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RGDPointBuilder*) builder; ++ (RGDPointBuilder*) builder; ++ (RGDPointBuilder*) builderWithPrototype:(RGDPoint*) prototype; +- (RGDPointBuilder*) toBuilder; + ++ (RGDPoint*) parseFromData:(NSData*) data; ++ (RGDPoint*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input; ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RGDPointBuilder : PBGeneratedMessageBuilder { +@private + RGDPoint* resultPoint; +} + +- (RGDPoint*) defaultInstance; + +- (RGDPointBuilder*) clear; +- (RGDPointBuilder*) clone; + +- (RGDPoint*) build; +- (RGDPoint*) buildPartial; + +- (RGDPointBuilder*) mergeFrom:(RGDPoint*) other; +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLatitude; +- (SInt32) latitude; +- (RGDPointBuilder*) setLatitude:(SInt32) value; +- (RGDPointBuilder*) clearLatitude; + +- (BOOL) hasLongitude; +- (SInt32) longitude; +- (RGDPointBuilder*) setLongitude:(SInt32) value; +- (RGDPointBuilder*) clearLongitude; +@end + +@interface RGDRectangle : PBGeneratedMessage<GeneratedMessageProtocol> { +@private + BOOL hasLo_:1; + BOOL hasHi_:1; + RGDPoint* lo; + RGDPoint* hi; +} +- (BOOL) hasLo; +- (BOOL) hasHi; +@property (readonly, strong) RGDPoint* lo; +@property (readonly, strong) RGDPoint* hi; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RGDRectangleBuilder*) builder; ++ (RGDRectangleBuilder*) builder; ++ (RGDRectangleBuilder*) builderWithPrototype:(RGDRectangle*) prototype; +- (RGDRectangleBuilder*) toBuilder; + ++ (RGDRectangle*) parseFromData:(NSData*) data; ++ (RGDRectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RGDRectangleBuilder : PBGeneratedMessageBuilder { +@private + RGDRectangle* resultRectangle; +} + +- (RGDRectangle*) defaultInstance; + +- (RGDRectangleBuilder*) clear; +- (RGDRectangleBuilder*) clone; + +- (RGDRectangle*) build; +- (RGDRectangle*) buildPartial; + +- (RGDRectangleBuilder*) mergeFrom:(RGDRectangle*) other; +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLo; +- (RGDPoint*) lo; +- (RGDRectangleBuilder*) setLo:(RGDPoint*) value; +- (RGDRectangleBuilder*) setLoBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRectangleBuilder*) mergeLo:(RGDPoint*) value; +- (RGDRectangleBuilder*) clearLo; + +- (BOOL) hasHi; +- (RGDPoint*) hi; +- (RGDRectangleBuilder*) setHi:(RGDPoint*) value; +- (RGDRectangleBuilder*) setHiBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRectangleBuilder*) mergeHi:(RGDPoint*) value; +- (RGDRectangleBuilder*) clearHi; +@end + +@interface RGDFeature : PBGeneratedMessage<GeneratedMessageProtocol> { +@private + BOOL hasName_:1; + BOOL hasLocation_:1; + NSString* name; + RGDPoint* location; +} +- (BOOL) hasName; +- (BOOL) hasLocation; +@property (readonly, strong) NSString* name; +@property (readonly, strong) RGDPoint* location; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RGDFeatureBuilder*) builder; ++ (RGDFeatureBuilder*) builder; ++ (RGDFeatureBuilder*) builderWithPrototype:(RGDFeature*) prototype; +- (RGDFeatureBuilder*) toBuilder; + ++ (RGDFeature*) parseFromData:(NSData*) data; ++ (RGDFeature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input; ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RGDFeatureBuilder : PBGeneratedMessageBuilder { +@private + RGDFeature* resultFeature; +} + +- (RGDFeature*) defaultInstance; + +- (RGDFeatureBuilder*) clear; +- (RGDFeatureBuilder*) clone; + +- (RGDFeature*) build; +- (RGDFeature*) buildPartial; + +- (RGDFeatureBuilder*) mergeFrom:(RGDFeature*) other; +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasName; +- (NSString*) name; +- (RGDFeatureBuilder*) setName:(NSString*) value; +- (RGDFeatureBuilder*) clearName; + +- (BOOL) hasLocation; +- (RGDPoint*) location; +- (RGDFeatureBuilder*) setLocation:(RGDPoint*) value; +- (RGDFeatureBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue; +- (RGDFeatureBuilder*) mergeLocation:(RGDPoint*) value; +- (RGDFeatureBuilder*) clearLocation; +@end + +@interface RGDRouteNote : PBGeneratedMessage<GeneratedMessageProtocol> { +@private + BOOL hasMessage_:1; + BOOL hasLocation_:1; + NSString* message; + RGDPoint* location; +} +- (BOOL) hasLocation; +- (BOOL) hasMessage; +@property (readonly, strong) RGDPoint* location; +@property (readonly, strong) NSString* message; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RGDRouteNoteBuilder*) builder; ++ (RGDRouteNoteBuilder*) builder; ++ (RGDRouteNoteBuilder*) builderWithPrototype:(RGDRouteNote*) prototype; +- (RGDRouteNoteBuilder*) toBuilder; + ++ (RGDRouteNote*) parseFromData:(NSData*) data; ++ (RGDRouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RGDRouteNoteBuilder : PBGeneratedMessageBuilder { +@private + RGDRouteNote* resultRouteNote; +} + +- (RGDRouteNote*) defaultInstance; + +- (RGDRouteNoteBuilder*) clear; +- (RGDRouteNoteBuilder*) clone; + +- (RGDRouteNote*) build; +- (RGDRouteNote*) buildPartial; + +- (RGDRouteNoteBuilder*) mergeFrom:(RGDRouteNote*) other; +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasLocation; +- (RGDPoint*) location; +- (RGDRouteNoteBuilder*) setLocation:(RGDPoint*) value; +- (RGDRouteNoteBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue; +- (RGDRouteNoteBuilder*) mergeLocation:(RGDPoint*) value; +- (RGDRouteNoteBuilder*) clearLocation; + +- (BOOL) hasMessage; +- (NSString*) message; +- (RGDRouteNoteBuilder*) setMessage:(NSString*) value; +- (RGDRouteNoteBuilder*) clearMessage; +@end + +@interface RGDRouteSummary : PBGeneratedMessage<GeneratedMessageProtocol> { +@private + BOOL hasPointCount_:1; + BOOL hasFeatureCount_:1; + BOOL hasDistance_:1; + BOOL hasElapsedTime_:1; + SInt32 pointCount; + SInt32 featureCount; + SInt32 distance; + SInt32 elapsedTime; +} +- (BOOL) hasPointCount; +- (BOOL) hasFeatureCount; +- (BOOL) hasDistance; +- (BOOL) hasElapsedTime; +@property (readonly) SInt32 pointCount; +@property (readonly) SInt32 featureCount; +@property (readonly) SInt32 distance; +@property (readonly) SInt32 elapsedTime; + ++ (instancetype) defaultInstance; +- (instancetype) defaultInstance; + +- (BOOL) isInitialized; +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; +- (RGDRouteSummaryBuilder*) builder; ++ (RGDRouteSummaryBuilder*) builder; ++ (RGDRouteSummaryBuilder*) builderWithPrototype:(RGDRouteSummary*) prototype; +- (RGDRouteSummaryBuilder*) toBuilder; + ++ (RGDRouteSummary*) parseFromData:(NSData*) data; ++ (RGDRouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input; ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input; ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; +@end + +@interface RGDRouteSummaryBuilder : PBGeneratedMessageBuilder { +@private + RGDRouteSummary* resultRouteSummary; +} + +- (RGDRouteSummary*) defaultInstance; + +- (RGDRouteSummaryBuilder*) clear; +- (RGDRouteSummaryBuilder*) clone; + +- (RGDRouteSummary*) build; +- (RGDRouteSummary*) buildPartial; + +- (RGDRouteSummaryBuilder*) mergeFrom:(RGDRouteSummary*) other; +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + +- (BOOL) hasPointCount; +- (SInt32) pointCount; +- (RGDRouteSummaryBuilder*) setPointCount:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearPointCount; + +- (BOOL) hasFeatureCount; +- (SInt32) featureCount; +- (RGDRouteSummaryBuilder*) setFeatureCount:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearFeatureCount; + +- (BOOL) hasDistance; +- (SInt32) distance; +- (RGDRouteSummaryBuilder*) setDistance:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearDistance; + +- (BOOL) hasElapsedTime; +- (SInt32) elapsedTime; +- (RGDRouteSummaryBuilder*) setElapsedTime:(SInt32) value; +- (RGDRouteSummaryBuilder*) clearElapsedTime; +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/protos/Route_guide.pb.m b/src/objective-c/examples/Sample/protos/Route_guide.pb.m new file mode 100644 index 0000000000000000000000000000000000000000..63cdd00206d82a3d1defb1f2c2427569378fa920 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.pb.m @@ -0,0 +1,1435 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#import "Route_guide.pb.h" +// @@protoc_insertion_point(imports) + +@implementation RGDRouteGuideRoot +static PBExtensionRegistry* extensionRegistry = nil; ++ (PBExtensionRegistry*) extensionRegistry { + return extensionRegistry; +} + ++ (void) initialize { + if (self == [RGDRouteGuideRoot class]) { + PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; + [self registerAllExtensions:registry]; + [ObjectivecDescriptorRoot registerAllExtensions:registry]; + extensionRegistry = registry; + } +} ++ (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { +} +@end + +@interface RGDPoint () +@property SInt32 latitude; +@property SInt32 longitude; +@end + +@implementation RGDPoint + +- (BOOL) hasLatitude { + return !!hasLatitude_; +} +- (void) setHasLatitude:(BOOL) _value_ { + hasLatitude_ = !!_value_; +} +@synthesize latitude; +- (BOOL) hasLongitude { + return !!hasLongitude_; +} +- (void) setHasLongitude:(BOOL) _value_ { + hasLongitude_ = !!_value_; +} +@synthesize longitude; +- (instancetype) init { + if ((self = [super init])) { + self.latitude = 0; + self.longitude = 0; + } + return self; +} +static RGDPoint* defaultRGDPointInstance = nil; ++ (void) initialize { + if (self == [RGDPoint class]) { + defaultRGDPointInstance = [[RGDPoint alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRGDPointInstance; +} +- (instancetype) defaultInstance { + return defaultRGDPointInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLatitude) { + [output writeInt32:1 value:self.latitude]; + } + if (self.hasLongitude) { + [output writeInt32:2 value:self.longitude]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLatitude) { + size_ += computeInt32Size(1, self.latitude); + } + if (self.hasLongitude) { + size_ += computeInt32Size(2, self.longitude); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RGDPoint*) parseFromData:(NSData*) data { + return (RGDPoint*)[[[RGDPoint builder] mergeFromData:data] build]; +} ++ (RGDPoint*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input { + return (RGDPoint*)[[[RGDPoint builder] mergeFromInputStream:input] build]; +} ++ (RGDPoint*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDPoint*)[[[RGDPoint builder] mergeFromCodedInputStream:input] build]; +} ++ (RGDPoint*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDPoint*)[[[RGDPoint builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDPointBuilder*) builder { + return [[RGDPointBuilder alloc] init]; +} ++ (RGDPointBuilder*) builderWithPrototype:(RGDPoint*) prototype { + return [[RGDPoint builder] mergeFrom:prototype]; +} +- (RGDPointBuilder*) builder { + return [RGDPoint builder]; +} +- (RGDPointBuilder*) toBuilder { + return [RGDPoint builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLatitude) { + [output appendFormat:@"%@%@: %@\n", indent, @"latitude", [NSNumber numberWithInteger:self.latitude]]; + } + if (self.hasLongitude) { + [output appendFormat:@"%@%@: %@\n", indent, @"longitude", [NSNumber numberWithInteger:self.longitude]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RGDPoint class]]) { + return NO; + } + RGDPoint *otherMessage = other; + return + self.hasLatitude == otherMessage.hasLatitude && + (!self.hasLatitude || self.latitude == otherMessage.latitude) && + self.hasLongitude == otherMessage.hasLongitude && + (!self.hasLongitude || self.longitude == otherMessage.longitude) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLatitude) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.latitude] hash]; + } + if (self.hasLongitude) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.longitude] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RGDPointBuilder() +@property (strong) RGDPoint* resultPoint; +@end + +@implementation RGDPointBuilder +@synthesize resultPoint; +- (instancetype) init { + if ((self = [super init])) { + self.resultPoint = [[RGDPoint alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultPoint; +} +- (RGDPointBuilder*) clear { + self.resultPoint = [[RGDPoint alloc] init]; + return self; +} +- (RGDPointBuilder*) clone { + return [RGDPoint builderWithPrototype:resultPoint]; +} +- (RGDPoint*) defaultInstance { + return [RGDPoint defaultInstance]; +} +- (RGDPoint*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RGDPoint*) buildPartial { + RGDPoint* returnMe = resultPoint; + self.resultPoint = nil; + return returnMe; +} +- (RGDPointBuilder*) mergeFrom:(RGDPoint*) other { + if (other == [RGDPoint defaultInstance]) { + return self; + } + if (other.hasLatitude) { + [self setLatitude:other.latitude]; + } + if (other.hasLongitude) { + [self setLongitude:other.longitude]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RGDPointBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setLatitude:[input readInt32]]; + break; + } + case 16: { + [self setLongitude:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasLatitude { + return resultPoint.hasLatitude; +} +- (SInt32) latitude { + return resultPoint.latitude; +} +- (RGDPointBuilder*) setLatitude:(SInt32) value { + resultPoint.hasLatitude = YES; + resultPoint.latitude = value; + return self; +} +- (RGDPointBuilder*) clearLatitude { + resultPoint.hasLatitude = NO; + resultPoint.latitude = 0; + return self; +} +- (BOOL) hasLongitude { + return resultPoint.hasLongitude; +} +- (SInt32) longitude { + return resultPoint.longitude; +} +- (RGDPointBuilder*) setLongitude:(SInt32) value { + resultPoint.hasLongitude = YES; + resultPoint.longitude = value; + return self; +} +- (RGDPointBuilder*) clearLongitude { + resultPoint.hasLongitude = NO; + resultPoint.longitude = 0; + return self; +} +@end + +@interface RGDRectangle () +@property (strong) RGDPoint* lo; +@property (strong) RGDPoint* hi; +@end + +@implementation RGDRectangle + +- (BOOL) hasLo { + return !!hasLo_; +} +- (void) setHasLo:(BOOL) _value_ { + hasLo_ = !!_value_; +} +@synthesize lo; +- (BOOL) hasHi { + return !!hasHi_; +} +- (void) setHasHi:(BOOL) _value_ { + hasHi_ = !!_value_; +} +@synthesize hi; +- (instancetype) init { + if ((self = [super init])) { + self.lo = [RGDPoint defaultInstance]; + self.hi = [RGDPoint defaultInstance]; + } + return self; +} +static RGDRectangle* defaultRGDRectangleInstance = nil; ++ (void) initialize { + if (self == [RGDRectangle class]) { + defaultRGDRectangleInstance = [[RGDRectangle alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRGDRectangleInstance; +} +- (instancetype) defaultInstance { + return defaultRGDRectangleInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLo) { + [output writeMessage:1 value:self.lo]; + } + if (self.hasHi) { + [output writeMessage:2 value:self.hi]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLo) { + size_ += computeMessageSize(1, self.lo); + } + if (self.hasHi) { + size_ += computeMessageSize(2, self.hi); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RGDRectangle*) parseFromData:(NSData*) data { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromData:data] build]; +} ++ (RGDRectangle*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromInputStream:input] build]; +} ++ (RGDRectangle*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromCodedInputStream:input] build]; +} ++ (RGDRectangle*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRectangle*)[[[RGDRectangle builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRectangleBuilder*) builder { + return [[RGDRectangleBuilder alloc] init]; +} ++ (RGDRectangleBuilder*) builderWithPrototype:(RGDRectangle*) prototype { + return [[RGDRectangle builder] mergeFrom:prototype]; +} +- (RGDRectangleBuilder*) builder { + return [RGDRectangle builder]; +} +- (RGDRectangleBuilder*) toBuilder { + return [RGDRectangle builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLo) { + [output appendFormat:@"%@%@ {\n", indent, @"lo"]; + [self.lo writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasHi) { + [output appendFormat:@"%@%@ {\n", indent, @"hi"]; + [self.hi writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RGDRectangle class]]) { + return NO; + } + RGDRectangle *otherMessage = other; + return + self.hasLo == otherMessage.hasLo && + (!self.hasLo || [self.lo isEqual:otherMessage.lo]) && + self.hasHi == otherMessage.hasHi && + (!self.hasHi || [self.hi isEqual:otherMessage.hi]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLo) { + hashCode = hashCode * 31 + [self.lo hash]; + } + if (self.hasHi) { + hashCode = hashCode * 31 + [self.hi hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RGDRectangleBuilder() +@property (strong) RGDRectangle* resultRectangle; +@end + +@implementation RGDRectangleBuilder +@synthesize resultRectangle; +- (instancetype) init { + if ((self = [super init])) { + self.resultRectangle = [[RGDRectangle alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRectangle; +} +- (RGDRectangleBuilder*) clear { + self.resultRectangle = [[RGDRectangle alloc] init]; + return self; +} +- (RGDRectangleBuilder*) clone { + return [RGDRectangle builderWithPrototype:resultRectangle]; +} +- (RGDRectangle*) defaultInstance { + return [RGDRectangle defaultInstance]; +} +- (RGDRectangle*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RGDRectangle*) buildPartial { + RGDRectangle* returnMe = resultRectangle; + self.resultRectangle = nil; + return returnMe; +} +- (RGDRectangleBuilder*) mergeFrom:(RGDRectangle*) other { + if (other == [RGDRectangle defaultInstance]) { + return self; + } + if (other.hasLo) { + [self mergeLo:other.lo]; + } + if (other.hasHi) { + [self mergeHi:other.hi]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RGDRectangleBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + RGDPointBuilder* subBuilder = [RGDPoint builder]; + if (self.hasLo) { + [subBuilder mergeFrom:self.lo]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLo:[subBuilder buildPartial]]; + break; + } + case 18: { + RGDPointBuilder* subBuilder = [RGDPoint builder]; + if (self.hasHi) { + [subBuilder mergeFrom:self.hi]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setHi:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasLo { + return resultRectangle.hasLo; +} +- (RGDPoint*) lo { + return resultRectangle.lo; +} +- (RGDRectangleBuilder*) setLo:(RGDPoint*) value { + resultRectangle.hasLo = YES; + resultRectangle.lo = value; + return self; +} +- (RGDRectangleBuilder*) setLoBuilder:(RGDPointBuilder*) builderForValue { + return [self setLo:[builderForValue build]]; +} +- (RGDRectangleBuilder*) mergeLo:(RGDPoint*) value { + if (resultRectangle.hasLo && + resultRectangle.lo != [RGDPoint defaultInstance]) { + resultRectangle.lo = + [[[RGDPoint builderWithPrototype:resultRectangle.lo] mergeFrom:value] buildPartial]; + } else { + resultRectangle.lo = value; + } + resultRectangle.hasLo = YES; + return self; +} +- (RGDRectangleBuilder*) clearLo { + resultRectangle.hasLo = NO; + resultRectangle.lo = [RGDPoint defaultInstance]; + return self; +} +- (BOOL) hasHi { + return resultRectangle.hasHi; +} +- (RGDPoint*) hi { + return resultRectangle.hi; +} +- (RGDRectangleBuilder*) setHi:(RGDPoint*) value { + resultRectangle.hasHi = YES; + resultRectangle.hi = value; + return self; +} +- (RGDRectangleBuilder*) setHiBuilder:(RGDPointBuilder*) builderForValue { + return [self setHi:[builderForValue build]]; +} +- (RGDRectangleBuilder*) mergeHi:(RGDPoint*) value { + if (resultRectangle.hasHi && + resultRectangle.hi != [RGDPoint defaultInstance]) { + resultRectangle.hi = + [[[RGDPoint builderWithPrototype:resultRectangle.hi] mergeFrom:value] buildPartial]; + } else { + resultRectangle.hi = value; + } + resultRectangle.hasHi = YES; + return self; +} +- (RGDRectangleBuilder*) clearHi { + resultRectangle.hasHi = NO; + resultRectangle.hi = [RGDPoint defaultInstance]; + return self; +} +@end + +@interface RGDFeature () +@property (strong) NSString* name; +@property (strong) RGDPoint* location; +@end + +@implementation RGDFeature + +- (BOOL) hasName { + return !!hasName_; +} +- (void) setHasName:(BOOL) _value_ { + hasName_ = !!_value_; +} +@synthesize name; +- (BOOL) hasLocation { + return !!hasLocation_; +} +- (void) setHasLocation:(BOOL) _value_ { + hasLocation_ = !!_value_; +} +@synthesize location; +- (instancetype) init { + if ((self = [super init])) { + self.name = @""; + self.location = [RGDPoint defaultInstance]; + } + return self; +} +static RGDFeature* defaultRGDFeatureInstance = nil; ++ (void) initialize { + if (self == [RGDFeature class]) { + defaultRGDFeatureInstance = [[RGDFeature alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRGDFeatureInstance; +} +- (instancetype) defaultInstance { + return defaultRGDFeatureInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasName) { + [output writeString:1 value:self.name]; + } + if (self.hasLocation) { + [output writeMessage:2 value:self.location]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasName) { + size_ += computeStringSize(1, self.name); + } + if (self.hasLocation) { + size_ += computeMessageSize(2, self.location); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RGDFeature*) parseFromData:(NSData*) data { + return (RGDFeature*)[[[RGDFeature builder] mergeFromData:data] build]; +} ++ (RGDFeature*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input { + return (RGDFeature*)[[[RGDFeature builder] mergeFromInputStream:input] build]; +} ++ (RGDFeature*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDFeature*)[[[RGDFeature builder] mergeFromCodedInputStream:input] build]; +} ++ (RGDFeature*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDFeature*)[[[RGDFeature builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDFeatureBuilder*) builder { + return [[RGDFeatureBuilder alloc] init]; +} ++ (RGDFeatureBuilder*) builderWithPrototype:(RGDFeature*) prototype { + return [[RGDFeature builder] mergeFrom:prototype]; +} +- (RGDFeatureBuilder*) builder { + return [RGDFeature builder]; +} +- (RGDFeatureBuilder*) toBuilder { + return [RGDFeature builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasName) { + [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; + } + if (self.hasLocation) { + [output appendFormat:@"%@%@ {\n", indent, @"location"]; + [self.location writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RGDFeature class]]) { + return NO; + } + RGDFeature *otherMessage = other; + return + self.hasName == otherMessage.hasName && + (!self.hasName || [self.name isEqual:otherMessage.name]) && + self.hasLocation == otherMessage.hasLocation && + (!self.hasLocation || [self.location isEqual:otherMessage.location]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasName) { + hashCode = hashCode * 31 + [self.name hash]; + } + if (self.hasLocation) { + hashCode = hashCode * 31 + [self.location hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RGDFeatureBuilder() +@property (strong) RGDFeature* resultFeature; +@end + +@implementation RGDFeatureBuilder +@synthesize resultFeature; +- (instancetype) init { + if ((self = [super init])) { + self.resultFeature = [[RGDFeature alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultFeature; +} +- (RGDFeatureBuilder*) clear { + self.resultFeature = [[RGDFeature alloc] init]; + return self; +} +- (RGDFeatureBuilder*) clone { + return [RGDFeature builderWithPrototype:resultFeature]; +} +- (RGDFeature*) defaultInstance { + return [RGDFeature defaultInstance]; +} +- (RGDFeature*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RGDFeature*) buildPartial { + RGDFeature* returnMe = resultFeature; + self.resultFeature = nil; + return returnMe; +} +- (RGDFeatureBuilder*) mergeFrom:(RGDFeature*) other { + if (other == [RGDFeature defaultInstance]) { + return self; + } + if (other.hasName) { + [self setName:other.name]; + } + if (other.hasLocation) { + [self mergeLocation:other.location]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RGDFeatureBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + [self setName:[input readString]]; + break; + } + case 18: { + RGDPointBuilder* subBuilder = [RGDPoint builder]; + if (self.hasLocation) { + [subBuilder mergeFrom:self.location]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLocation:[subBuilder buildPartial]]; + break; + } + } + } +} +- (BOOL) hasName { + return resultFeature.hasName; +} +- (NSString*) name { + return resultFeature.name; +} +- (RGDFeatureBuilder*) setName:(NSString*) value { + resultFeature.hasName = YES; + resultFeature.name = value; + return self; +} +- (RGDFeatureBuilder*) clearName { + resultFeature.hasName = NO; + resultFeature.name = @""; + return self; +} +- (BOOL) hasLocation { + return resultFeature.hasLocation; +} +- (RGDPoint*) location { + return resultFeature.location; +} +- (RGDFeatureBuilder*) setLocation:(RGDPoint*) value { + resultFeature.hasLocation = YES; + resultFeature.location = value; + return self; +} +- (RGDFeatureBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue { + return [self setLocation:[builderForValue build]]; +} +- (RGDFeatureBuilder*) mergeLocation:(RGDPoint*) value { + if (resultFeature.hasLocation && + resultFeature.location != [RGDPoint defaultInstance]) { + resultFeature.location = + [[[RGDPoint builderWithPrototype:resultFeature.location] mergeFrom:value] buildPartial]; + } else { + resultFeature.location = value; + } + resultFeature.hasLocation = YES; + return self; +} +- (RGDFeatureBuilder*) clearLocation { + resultFeature.hasLocation = NO; + resultFeature.location = [RGDPoint defaultInstance]; + return self; +} +@end + +@interface RGDRouteNote () +@property (strong) RGDPoint* location; +@property (strong) NSString* message; +@end + +@implementation RGDRouteNote + +- (BOOL) hasLocation { + return !!hasLocation_; +} +- (void) setHasLocation:(BOOL) _value_ { + hasLocation_ = !!_value_; +} +@synthesize location; +- (BOOL) hasMessage { + return !!hasMessage_; +} +- (void) setHasMessage:(BOOL) _value_ { + hasMessage_ = !!_value_; +} +@synthesize message; +- (instancetype) init { + if ((self = [super init])) { + self.location = [RGDPoint defaultInstance]; + self.message = @""; + } + return self; +} +static RGDRouteNote* defaultRGDRouteNoteInstance = nil; ++ (void) initialize { + if (self == [RGDRouteNote class]) { + defaultRGDRouteNoteInstance = [[RGDRouteNote alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRGDRouteNoteInstance; +} +- (instancetype) defaultInstance { + return defaultRGDRouteNoteInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasLocation) { + [output writeMessage:1 value:self.location]; + } + if (self.hasMessage) { + [output writeString:2 value:self.message]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasLocation) { + size_ += computeMessageSize(1, self.location); + } + if (self.hasMessage) { + size_ += computeStringSize(2, self.message); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RGDRouteNote*) parseFromData:(NSData*) data { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromData:data] build]; +} ++ (RGDRouteNote*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromInputStream:input] build]; +} ++ (RGDRouteNote*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromCodedInputStream:input] build]; +} ++ (RGDRouteNote*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteNote*)[[[RGDRouteNote builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteNoteBuilder*) builder { + return [[RGDRouteNoteBuilder alloc] init]; +} ++ (RGDRouteNoteBuilder*) builderWithPrototype:(RGDRouteNote*) prototype { + return [[RGDRouteNote builder] mergeFrom:prototype]; +} +- (RGDRouteNoteBuilder*) builder { + return [RGDRouteNote builder]; +} +- (RGDRouteNoteBuilder*) toBuilder { + return [RGDRouteNote builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasLocation) { + [output appendFormat:@"%@%@ {\n", indent, @"location"]; + [self.location writeDescriptionTo:output + withIndent:[NSString stringWithFormat:@"%@ ", indent]]; + [output appendFormat:@"%@}\n", indent]; + } + if (self.hasMessage) { + [output appendFormat:@"%@%@: %@\n", indent, @"message", self.message]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RGDRouteNote class]]) { + return NO; + } + RGDRouteNote *otherMessage = other; + return + self.hasLocation == otherMessage.hasLocation && + (!self.hasLocation || [self.location isEqual:otherMessage.location]) && + self.hasMessage == otherMessage.hasMessage && + (!self.hasMessage || [self.message isEqual:otherMessage.message]) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasLocation) { + hashCode = hashCode * 31 + [self.location hash]; + } + if (self.hasMessage) { + hashCode = hashCode * 31 + [self.message hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RGDRouteNoteBuilder() +@property (strong) RGDRouteNote* resultRouteNote; +@end + +@implementation RGDRouteNoteBuilder +@synthesize resultRouteNote; +- (instancetype) init { + if ((self = [super init])) { + self.resultRouteNote = [[RGDRouteNote alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRouteNote; +} +- (RGDRouteNoteBuilder*) clear { + self.resultRouteNote = [[RGDRouteNote alloc] init]; + return self; +} +- (RGDRouteNoteBuilder*) clone { + return [RGDRouteNote builderWithPrototype:resultRouteNote]; +} +- (RGDRouteNote*) defaultInstance { + return [RGDRouteNote defaultInstance]; +} +- (RGDRouteNote*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RGDRouteNote*) buildPartial { + RGDRouteNote* returnMe = resultRouteNote; + self.resultRouteNote = nil; + return returnMe; +} +- (RGDRouteNoteBuilder*) mergeFrom:(RGDRouteNote*) other { + if (other == [RGDRouteNote defaultInstance]) { + return self; + } + if (other.hasLocation) { + [self mergeLocation:other.location]; + } + if (other.hasMessage) { + [self setMessage:other.message]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RGDRouteNoteBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 10: { + RGDPointBuilder* subBuilder = [RGDPoint builder]; + if (self.hasLocation) { + [subBuilder mergeFrom:self.location]; + } + [input readMessage:subBuilder extensionRegistry:extensionRegistry]; + [self setLocation:[subBuilder buildPartial]]; + break; + } + case 18: { + [self setMessage:[input readString]]; + break; + } + } + } +} +- (BOOL) hasLocation { + return resultRouteNote.hasLocation; +} +- (RGDPoint*) location { + return resultRouteNote.location; +} +- (RGDRouteNoteBuilder*) setLocation:(RGDPoint*) value { + resultRouteNote.hasLocation = YES; + resultRouteNote.location = value; + return self; +} +- (RGDRouteNoteBuilder*) setLocationBuilder:(RGDPointBuilder*) builderForValue { + return [self setLocation:[builderForValue build]]; +} +- (RGDRouteNoteBuilder*) mergeLocation:(RGDPoint*) value { + if (resultRouteNote.hasLocation && + resultRouteNote.location != [RGDPoint defaultInstance]) { + resultRouteNote.location = + [[[RGDPoint builderWithPrototype:resultRouteNote.location] mergeFrom:value] buildPartial]; + } else { + resultRouteNote.location = value; + } + resultRouteNote.hasLocation = YES; + return self; +} +- (RGDRouteNoteBuilder*) clearLocation { + resultRouteNote.hasLocation = NO; + resultRouteNote.location = [RGDPoint defaultInstance]; + return self; +} +- (BOOL) hasMessage { + return resultRouteNote.hasMessage; +} +- (NSString*) message { + return resultRouteNote.message; +} +- (RGDRouteNoteBuilder*) setMessage:(NSString*) value { + resultRouteNote.hasMessage = YES; + resultRouteNote.message = value; + return self; +} +- (RGDRouteNoteBuilder*) clearMessage { + resultRouteNote.hasMessage = NO; + resultRouteNote.message = @""; + return self; +} +@end + +@interface RGDRouteSummary () +@property SInt32 pointCount; +@property SInt32 featureCount; +@property SInt32 distance; +@property SInt32 elapsedTime; +@end + +@implementation RGDRouteSummary + +- (BOOL) hasPointCount { + return !!hasPointCount_; +} +- (void) setHasPointCount:(BOOL) _value_ { + hasPointCount_ = !!_value_; +} +@synthesize pointCount; +- (BOOL) hasFeatureCount { + return !!hasFeatureCount_; +} +- (void) setHasFeatureCount:(BOOL) _value_ { + hasFeatureCount_ = !!_value_; +} +@synthesize featureCount; +- (BOOL) hasDistance { + return !!hasDistance_; +} +- (void) setHasDistance:(BOOL) _value_ { + hasDistance_ = !!_value_; +} +@synthesize distance; +- (BOOL) hasElapsedTime { + return !!hasElapsedTime_; +} +- (void) setHasElapsedTime:(BOOL) _value_ { + hasElapsedTime_ = !!_value_; +} +@synthesize elapsedTime; +- (instancetype) init { + if ((self = [super init])) { + self.pointCount = 0; + self.featureCount = 0; + self.distance = 0; + self.elapsedTime = 0; + } + return self; +} +static RGDRouteSummary* defaultRGDRouteSummaryInstance = nil; ++ (void) initialize { + if (self == [RGDRouteSummary class]) { + defaultRGDRouteSummaryInstance = [[RGDRouteSummary alloc] init]; + } +} ++ (instancetype) defaultInstance { + return defaultRGDRouteSummaryInstance; +} +- (instancetype) defaultInstance { + return defaultRGDRouteSummaryInstance; +} +- (BOOL) isInitialized { + return YES; +} +- (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { + if (self.hasPointCount) { + [output writeInt32:1 value:self.pointCount]; + } + if (self.hasFeatureCount) { + [output writeInt32:2 value:self.featureCount]; + } + if (self.hasDistance) { + [output writeInt32:3 value:self.distance]; + } + if (self.hasElapsedTime) { + [output writeInt32:4 value:self.elapsedTime]; + } + [self.unknownFields writeToCodedOutputStream:output]; +} +- (SInt32) serializedSize { + __block SInt32 size_ = memoizedSerializedSize; + if (size_ != -1) { + return size_; + } + + size_ = 0; + if (self.hasPointCount) { + size_ += computeInt32Size(1, self.pointCount); + } + if (self.hasFeatureCount) { + size_ += computeInt32Size(2, self.featureCount); + } + if (self.hasDistance) { + size_ += computeInt32Size(3, self.distance); + } + if (self.hasElapsedTime) { + size_ += computeInt32Size(4, self.elapsedTime); + } + size_ += self.unknownFields.serializedSize; + memoizedSerializedSize = size_; + return size_; +} ++ (RGDRouteSummary*) parseFromData:(NSData*) data { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromData:data] build]; +} ++ (RGDRouteSummary*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromInputStream:input] build]; +} ++ (RGDRouteSummary*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromCodedInputStream:input] build]; +} ++ (RGDRouteSummary*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + return (RGDRouteSummary*)[[[RGDRouteSummary builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; +} ++ (RGDRouteSummaryBuilder*) builder { + return [[RGDRouteSummaryBuilder alloc] init]; +} ++ (RGDRouteSummaryBuilder*) builderWithPrototype:(RGDRouteSummary*) prototype { + return [[RGDRouteSummary builder] mergeFrom:prototype]; +} +- (RGDRouteSummaryBuilder*) builder { + return [RGDRouteSummary builder]; +} +- (RGDRouteSummaryBuilder*) toBuilder { + return [RGDRouteSummary builderWithPrototype:self]; +} +- (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { + if (self.hasPointCount) { + [output appendFormat:@"%@%@: %@\n", indent, @"pointCount", [NSNumber numberWithInteger:self.pointCount]]; + } + if (self.hasFeatureCount) { + [output appendFormat:@"%@%@: %@\n", indent, @"featureCount", [NSNumber numberWithInteger:self.featureCount]]; + } + if (self.hasDistance) { + [output appendFormat:@"%@%@: %@\n", indent, @"distance", [NSNumber numberWithInteger:self.distance]]; + } + if (self.hasElapsedTime) { + [output appendFormat:@"%@%@: %@\n", indent, @"elapsedTime", [NSNumber numberWithInteger:self.elapsedTime]]; + } + [self.unknownFields writeDescriptionTo:output withIndent:indent]; +} +- (BOOL) isEqual:(id)other { + if (other == self) { + return YES; + } + if (![other isKindOfClass:[RGDRouteSummary class]]) { + return NO; + } + RGDRouteSummary *otherMessage = other; + return + self.hasPointCount == otherMessage.hasPointCount && + (!self.hasPointCount || self.pointCount == otherMessage.pointCount) && + self.hasFeatureCount == otherMessage.hasFeatureCount && + (!self.hasFeatureCount || self.featureCount == otherMessage.featureCount) && + self.hasDistance == otherMessage.hasDistance && + (!self.hasDistance || self.distance == otherMessage.distance) && + self.hasElapsedTime == otherMessage.hasElapsedTime && + (!self.hasElapsedTime || self.elapsedTime == otherMessage.elapsedTime) && + (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); +} +- (NSUInteger) hash { + __block NSUInteger hashCode = 7; + if (self.hasPointCount) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.pointCount] hash]; + } + if (self.hasFeatureCount) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.featureCount] hash]; + } + if (self.hasDistance) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.distance] hash]; + } + if (self.hasElapsedTime) { + hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.elapsedTime] hash]; + } + hashCode = hashCode * 31 + [self.unknownFields hash]; + return hashCode; +} +@end + +@interface RGDRouteSummaryBuilder() +@property (strong) RGDRouteSummary* resultRouteSummary; +@end + +@implementation RGDRouteSummaryBuilder +@synthesize resultRouteSummary; +- (instancetype) init { + if ((self = [super init])) { + self.resultRouteSummary = [[RGDRouteSummary alloc] init]; + } + return self; +} +- (PBGeneratedMessage*) internalGetResult { + return resultRouteSummary; +} +- (RGDRouteSummaryBuilder*) clear { + self.resultRouteSummary = [[RGDRouteSummary alloc] init]; + return self; +} +- (RGDRouteSummaryBuilder*) clone { + return [RGDRouteSummary builderWithPrototype:resultRouteSummary]; +} +- (RGDRouteSummary*) defaultInstance { + return [RGDRouteSummary defaultInstance]; +} +- (RGDRouteSummary*) build { + [self checkInitialized]; + return [self buildPartial]; +} +- (RGDRouteSummary*) buildPartial { + RGDRouteSummary* returnMe = resultRouteSummary; + self.resultRouteSummary = nil; + return returnMe; +} +- (RGDRouteSummaryBuilder*) mergeFrom:(RGDRouteSummary*) other { + if (other == [RGDRouteSummary defaultInstance]) { + return self; + } + if (other.hasPointCount) { + [self setPointCount:other.pointCount]; + } + if (other.hasFeatureCount) { + [self setFeatureCount:other.featureCount]; + } + if (other.hasDistance) { + [self setDistance:other.distance]; + } + if (other.hasElapsedTime) { + [self setElapsedTime:other.elapsedTime]; + } + [self mergeUnknownFields:other.unknownFields]; + return self; +} +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { + return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; +} +- (RGDRouteSummaryBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { + PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; + while (YES) { + SInt32 tag = [input readTag]; + switch (tag) { + case 0: + [self setUnknownFields:[unknownFields build]]; + return self; + default: { + if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { + [self setUnknownFields:[unknownFields build]]; + return self; + } + break; + } + case 8: { + [self setPointCount:[input readInt32]]; + break; + } + case 16: { + [self setFeatureCount:[input readInt32]]; + break; + } + case 24: { + [self setDistance:[input readInt32]]; + break; + } + case 32: { + [self setElapsedTime:[input readInt32]]; + break; + } + } + } +} +- (BOOL) hasPointCount { + return resultRouteSummary.hasPointCount; +} +- (SInt32) pointCount { + return resultRouteSummary.pointCount; +} +- (RGDRouteSummaryBuilder*) setPointCount:(SInt32) value { + resultRouteSummary.hasPointCount = YES; + resultRouteSummary.pointCount = value; + return self; +} +- (RGDRouteSummaryBuilder*) clearPointCount { + resultRouteSummary.hasPointCount = NO; + resultRouteSummary.pointCount = 0; + return self; +} +- (BOOL) hasFeatureCount { + return resultRouteSummary.hasFeatureCount; +} +- (SInt32) featureCount { + return resultRouteSummary.featureCount; +} +- (RGDRouteSummaryBuilder*) setFeatureCount:(SInt32) value { + resultRouteSummary.hasFeatureCount = YES; + resultRouteSummary.featureCount = value; + return self; +} +- (RGDRouteSummaryBuilder*) clearFeatureCount { + resultRouteSummary.hasFeatureCount = NO; + resultRouteSummary.featureCount = 0; + return self; +} +- (BOOL) hasDistance { + return resultRouteSummary.hasDistance; +} +- (SInt32) distance { + return resultRouteSummary.distance; +} +- (RGDRouteSummaryBuilder*) setDistance:(SInt32) value { + resultRouteSummary.hasDistance = YES; + resultRouteSummary.distance = value; + return self; +} +- (RGDRouteSummaryBuilder*) clearDistance { + resultRouteSummary.hasDistance = NO; + resultRouteSummary.distance = 0; + return self; +} +- (BOOL) hasElapsedTime { + return resultRouteSummary.hasElapsedTime; +} +- (SInt32) elapsedTime { + return resultRouteSummary.elapsedTime; +} +- (RGDRouteSummaryBuilder*) setElapsedTime:(SInt32) value { + resultRouteSummary.hasElapsedTime = YES; + resultRouteSummary.elapsedTime = value; + return self; +} +- (RGDRouteSummaryBuilder*) clearElapsedTime { + resultRouteSummary.hasElapsedTime = NO; + resultRouteSummary.elapsedTime = 0; + return self; +} +@end + + +// @@protoc_insertion_point(global_scope) diff --git a/src/objective-c/examples/Sample/protos/Route_guide.podspec b/src/objective-c/examples/Sample/protos/Route_guide.podspec new file mode 100644 index 0000000000000000000000000000000000000000..6fba1c5c1e370c6a56befa09e8660c364c523379 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/Route_guide.podspec @@ -0,0 +1,17 @@ +Pod::Spec.new do |s| + s.name = 'Route_guide' + s.version = '0.0.1' + s.summary = 'Protobuf library generated from route_guide.proto' + s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/protos' + s.license = 'New BSD' + s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } + + s.source_files = '*.pb.{h,m}' + s.public_header_files = '*.pb.h' + + s.platform = :ios + s.ios.deployment_target = '6.0' + s.requires_arc = true + + s.dependency 'ProtocolBuffers', '~> 1.9' +end diff --git a/src/objective-c/examples/Sample/protos/route_guide.proto b/src/objective-c/examples/Sample/protos/route_guide.proto new file mode 100644 index 0000000000000000000000000000000000000000..91b0372a079447af55766f5de6d963203583e3e7 --- /dev/null +++ b/src/objective-c/examples/Sample/protos/route_guide.proto @@ -0,0 +1,121 @@ +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto2"; + +package grpc.example.routeguide; + +import "google/protobuf/objectivec-descriptor.proto"; +option (google.protobuf.objectivec_file_options).class_prefix = "RGD"; + +// Interface exported by the server. +service RouteGuide { + // A simple RPC. + // + // Obtains the feature at a given position. + rpc GetFeature(Point) returns (Feature) {} + + // A server-to-client streaming RPC. + // + // Obtains the Features available within the given Rectangle. Results are + // streamed rather than returned at once (e.g. in a response message with a + // repeated field), as the rectangle may cover a large area and contain a + // huge number of features. +// rpc ListFeatures(Rectangle) returns (stream Feature) {} + + // A client-to-server streaming RPC. + // + // Accepts a stream of Points on a route being traversed, returning a + // RouteSummary when traversal is completed. +// rpc RecordRoute(stream Point) returns (RouteSummary) {} + + // A Bidirectional streaming RPC. + // + // Accepts a stream of RouteNotes sent while a route is being traversed, + // while receiving other RouteNotes (e.g. from other users). +// rpc RouteChat(stream RouteNote) returns (stream RouteNote) {} +} + +// Points are represented as latitude-longitude pairs in the E7 representation +// (degrees multiplied by 10**7 and rounded to the nearest integer). +// Latitudes should be in the range +/- 90 degrees and longitude should be in +// the range +/- 180 degrees (inclusive). +message Point { + optional int32 latitude = 1; + optional int32 longitude = 2; +} + +// A latitude-longitude rectangle, represented as two diagonally opposite +// points "lo" and "hi". +message Rectangle { + // One corner of the rectangle. + optional Point lo = 1; + + // The other corner of the rectangle. + optional Point hi = 2; +} + +// A feature names something at a given point. +// +// If a feature could not be named, the name is empty. +message Feature { + // The name of the feature. + optional string name = 1; + + // The point where the feature is detected. + optional Point location = 2; +} + +// A RouteNote is a message sent while at a given point. +message RouteNote { + // The location from which the message is sent. + optional Point location = 1; + + // The message to be sent. + optional string message = 2; +} + +// A RouteSummary is received in response to a RecordRoute rpc. +// +// It contains the number of individual points received, the number of +// detected features, and the total distance covered as the cumulative sum of +// the distance between each point. +message RouteSummary { + // The number of points received. + optional int32 point_count = 1; + + // The number of known features passed while traversing the route. + optional int32 feature_count = 2; + + // The distance covered in metres. + optional int32 distance = 3; + + // The duration of the traversal in seconds. + optional int32 elapsed_time = 4; +} \ No newline at end of file diff --git a/src/php/bin/run_gen_code_test.sh b/src/php/bin/run_gen_code_test.sh index 3f176fb5e4aad2d81195a07f680bf55d1e4a5d73..79abbe6cf8c25aac9b8db3b5f77845f7f475361b 100755 --- a/src/php/bin/run_gen_code_test.sh +++ b/src/php/bin/run_gen_code_test.sh @@ -32,3 +32,6 @@ cd $(dirname $0) GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ ../tests/generated_code/GeneratedCodeTest.php +GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ + -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ + ../tests/generated_code/GeneratedCodeWithCallbackTest.php diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index fc83dace20552b7838487a1b3688e2d210068136..cb2537fe98d4308d6fb9554b4ce649208eaf238f 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -41,7 +41,24 @@ class BaseStub { private $channel; + // a callback function + private $update_metadata; + + /** + * @param $hostname string + * @param $opts array + * - 'update_metadata': (optional) a callback function which takes in a + * metadata array, and returns an updated metadata array + */ public function __construct($hostname, $opts) { + $this->update_metadata = null; + if (isset($opts['update_metadata'])) { + if (is_callable($opts['update_metadata'])) { + $this->update_metadata = $opts['update_metadata']; + } + unset($opts['update_metadata']); + } + $this->channel = new Channel($hostname, $opts); } @@ -69,7 +86,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new UnaryCall($this->channel, $method, $deserialize); - $call->start($argument, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($argument, $actual_metadata); return $call; } @@ -89,7 +111,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new ClientStreamingCall($this->channel, $method, $deserialize); - $call->start($arguments, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($arguments, $actual_metadata); return $call; } @@ -108,7 +135,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new ServerStreamingCall($this->channel, $method, $deserialize); - $call->start($argument, $metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($argument, $actual_metadata); return $call; } @@ -124,7 +156,12 @@ class BaseStub { callable $deserialize, $metadata = array()) { $call = new BidiStreamingCall($this->channel, $method, $deserialize); - $call->start($metadata); + $actual_metadata = $metadata; + if (is_callable($this->update_metadata)) { + $actual_metadata = call_user_func($this->update_metadata, + $actual_metadata); + } + $call->start($actual_metadata); return $call; } } diff --git a/src/php/tests/generated_code/AbstractGeneratedCodeTest.php b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2d2352b19965134da56a3f3a3d1e0951dcc0d808 --- /dev/null +++ b/src/php/tests/generated_code/AbstractGeneratedCodeTest.php @@ -0,0 +1,97 @@ +<?php +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); +require 'DrSlump/Protobuf.php'; +\DrSlump\Protobuf::autoload(); +require 'math.php'; +abstract class AbstractGeneratedCodeTest extends PHPUnit_Framework_TestCase { + /* These tests require that a server exporting the math service must be + * running on $GRPC_TEST_HOST */ + protected static $client; + protected static $timeout; + + public function testSimpleRequest() { + $div_arg = new math\DivArgs(); + $div_arg->setDividend(7); + $div_arg->setDivisor(4); + list($response, $status) = self::$client->Div($div_arg)->wait(); + $this->assertSame(1, $response->getQuotient()); + $this->assertSame(3, $response->getRemainder()); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testServerStreaming() { + $fib_arg = new math\FibArgs(); + $fib_arg->setLimit(7); + $call = self::$client->Fib($fib_arg); + $result_array = iterator_to_array($call->responses()); + $extract_num = function($num){ + return $num->getNum(); + }; + $values = array_map($extract_num, $result_array); + $this->assertSame([1, 1, 2, 3, 5, 8, 13], $values); + $status = $call->getStatus(); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testClientStreaming() { + $num_iter = function() { + for ($i = 0; $i < 7; $i++) { + $num = new math\Num(); + $num->setNum($i); + yield $num; + } + }; + $call = self::$client->Sum($num_iter()); + list($response, $status) = $call->wait(); + $this->assertSame(21, $response->getNum()); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } + + public function testBidiStreaming() { + $call = self::$client->DivMany(); + for ($i = 0; $i < 7; $i++) { + $div_arg = new math\DivArgs(); + $div_arg->setDividend(2 * $i + 1); + $div_arg->setDivisor(2); + $call->write($div_arg); + $response = $call->read(); + $this->assertSame($i, $response->getQuotient()); + $this->assertSame(1, $response->getRemainder()); + } + $call->writesDone(); + $status = $call->getStatus(); + $this->assertSame(\Grpc\STATUS_OK, $status->code); + } +} diff --git a/src/php/tests/generated_code/GeneratedCodeTest.php b/src/php/tests/generated_code/GeneratedCodeTest.php index 927d24ca63086c4eaa961619030e974b3cfdfa77..1e4742fc8009c5a599d8dded588b7d6bd76c10b6 100755 --- a/src/php/tests/generated_code/GeneratedCodeTest.php +++ b/src/php/tests/generated_code/GeneratedCodeTest.php @@ -31,71 +31,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ -require_once realpath(dirname(__FILE__) . '/../../vendor/autoload.php'); -require 'DrSlump/Protobuf.php'; -\DrSlump\Protobuf::autoload(); -require 'math.php'; -class GeneratedCodeTest extends PHPUnit_Framework_TestCase { - /* These tests require that a server exporting the math service must be - * running on $GRPC_TEST_HOST */ - protected static $client; - protected static $timeout; +require 'AbstractGeneratedCodeTest.php'; + +class GeneratedCodeTest extends AbstractGeneratedCodeTest { public static function setUpBeforeClass() { self::$client = new math\MathClient(new Grpc\BaseStub( getenv('GRPC_TEST_HOST'), [])); } - - public function testSimpleRequest() { - $div_arg = new math\DivArgs(); - $div_arg->setDividend(7); - $div_arg->setDivisor(4); - list($response, $status) = self::$client->Div($div_arg)->wait(); - $this->assertSame(1, $response->getQuotient()); - $this->assertSame(3, $response->getRemainder()); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testServerStreaming() { - $fib_arg = new math\FibArgs(); - $fib_arg->setLimit(7); - $call = self::$client->Fib($fib_arg); - $result_array = iterator_to_array($call->responses()); - $extract_num = function($num){ - return $num->getNum(); - }; - $values = array_map($extract_num, $result_array); - $this->assertSame([1, 1, 2, 3, 5, 8, 13], $values); - $status = $call->getStatus(); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testClientStreaming() { - $num_iter = function() { - for ($i = 0; $i < 7; $i++) { - $num = new math\Num(); - $num->setNum($i); - yield $num; - } - }; - $call = self::$client->Sum($num_iter()); - list($response, $status) = $call->wait(); - $this->assertSame(21, $response->getNum()); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } - - public function testBidiStreaming() { - $call = self::$client->DivMany(); - for ($i = 0; $i < 7; $i++) { - $div_arg = new math\DivArgs(); - $div_arg->setDividend(2 * $i + 1); - $div_arg->setDivisor(2); - $call->write($div_arg); - $response = $call->read(); - $this->assertSame($i, $response->getQuotient()); - $this->assertSame(1, $response->getRemainder()); - } - $call->writesDone(); - $status = $call->getStatus(); - $this->assertSame(\Grpc\STATUS_OK, $status->code); - } } diff --git a/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9ec95375e913075ae925041959680cd20d6e93be --- /dev/null +++ b/src/php/tests/generated_code/GeneratedCodeWithCallbackTest.php @@ -0,0 +1,48 @@ +<?php +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +require 'AbstractGeneratedCodeTest.php'; + +class GeneratedCodeWithCallbackTest extends AbstractGeneratedCodeTest { + public static function setUpBeforeClass() { + self::$client = new math\MathClient(new Grpc\BaseStub( + getenv('GRPC_TEST_HOST'), ['update_metadata' => + function($a_hash, + $opts = array(), + $client = array()) { + $a_copy = $a_hash; + $a_copy['foo'] = ['bar']; + return $a_copy; + }])); + } +} diff --git a/templates/vsprojects/vcxproj_defs.include b/templates/vsprojects/vcxproj_defs.include index 61baa2b35de37643f11872d7ee32e6056e07b7e0..062a3b02476c31653465f211696334b9ec545135 100644 --- a/templates/vsprojects/vcxproj_defs.include +++ b/templates/vsprojects/vcxproj_defs.include @@ -56,7 +56,7 @@ ${gen_package_props(packages)}\ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\global.props" /> % for prop in additional_props: - <Import Project="..\${prop}." /> + <Import Project="..\${prop}.props" /> % endfor </ImportGroup> <PropertyGroup Label="UserMacros" /> diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh index c745edb7970190eaacaa9edd1f8841bb306c5265..cdea1f93192d0035bf4d7c16e143e26131c7c7b0 100755 --- a/tools/buildgen/generate_projects.sh +++ b/tools/buildgen/generate_projects.sh @@ -40,7 +40,9 @@ cd `dirname $0`/../.. mako_renderer=tools/buildgen/mako_renderer.py gen_build_json=test/core/end2end/gen_build_json.py -tools/buildgen/build-cleaner.py build.json +if [ "x$TEST" != "x" ] ; then + tools/buildgen/build-cleaner.py build.json +fi end2end_test_build=`mktemp /tmp/genXXXXXX` $gen_build_json > $end2end_test_build diff --git a/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj b/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj index 501b0d9b1ab51f24658d90ee5aee6043c22981e5..2adb4a5367ea4430b50ddd7d6bbcbad1d1bb94f3 100644 --- a/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj +++ b/vsprojects/grpc_csharp_ext/grpc_csharp_ext.vcxproj @@ -46,7 +46,7 @@ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\global.props" /> - <Import Project="..\winsock." /> + <Import Project="..\winsock.props" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> diff --git a/vsprojects/nuget_package/.gitignore b/vsprojects/nuget_package/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ae830da1b219d6fc7a7bcc2f5ac175ab9218efc3 --- /dev/null +++ b/vsprojects/nuget_package/.gitignore @@ -0,0 +1,3 @@ +/tmp +/output +*.nupkg diff --git a/vsprojects/nuget_package/README.md b/vsprojects/nuget_package/README.md new file mode 100644 index 0000000000000000000000000000000000000000..80d84ce8c8c043e31349e88f5c431ab3a49830a5 --- /dev/null +++ b/vsprojects/nuget_package/README.md @@ -0,0 +1,20 @@ +gRPC Native Nuget package +========================= + +Prerequisites +------------- +Multiple versions of VS installed to be able to build all the targets: +* 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_ext +``` \ No newline at end of file diff --git a/vsprojects/nuget_package/buildall.bat b/vsprojects/nuget_package/buildall.bat new file mode 100644 index 0000000000000000000000000000000000000000..837eef0f6ad66f026872fcd54e5270f51621d877 --- /dev/null +++ b/vsprojects/nuget_package/buildall.bat @@ -0,0 +1,46 @@ +@echo off +setlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v120 || goto :eof +REM call :build x64 Debug v120 || goto :eof +REM 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 + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v110 || goto :eof +REM call :build x64 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +REM call :build Win32 Release v110 || goto :eof +REM call :build Win32 Debug v110 || goto :eof +REM endlocal + +REM setlocal +REM call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 +REM call :build x64 Release v100 || goto :eof +REM call :build x64 Debug v100 || goto :eof +REM endlocal + +setlocal +call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 +call :build Win32 Release v100 || goto :eof +call :build Win32 Debug v100 || goto :eof +endlocal + +goto :eof + +:build +msbuild /t:grpc_csharp_ext /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.sln || goto :eof +goto :eof + + diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec b/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec new file mode 100644 index 0000000000000000000000000000000000000000..d225b7719070400e4fe4429caa8bf591d2e18b28 --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.nuspec @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<package> + <metadata> + <id>grpc.native.csharp_ext</id> + <version>0.6.0.0</version> + <authors>Google Inc.</authors> + <owners>Jan Tattermusch</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 0.6.0 libraries.</releaseNotes> + <copyright>Copyright 2015</copyright> + <title>gRPC C# Native Extension</title> + <summary>Native library required by gRPC C#</summary> + <tags>gRPC native</tags> + <dependencies> + <dependency id="grpc.dependencies.zlib.redist" version="1.2.8.9" /> + <dependency id="grpc.dependencies.openssl.redist" version="1.0.2.2" /> + </dependencies> + </metadata> + <files> + <file src="grpc.native.csharp_ext.props" target="\build\portable-net45\grpc.native.csharp_ext.props" /> + <file src="grpc.native.csharp_ext.targets" target="\build\portable-net45\grpc.native.csharp_ext.targets" /> + <file src="output\v100\Win32\Release\grpc_csharp_ext.dll" target="/build/native/bin/v100\Win32\Release\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\v100\Win32\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v100\Win32\Debug\grpc_csharp_ext.dll" /> + <file src="output\v120\Win32\Debug\grpc_csharp_ext.dll" target="/build/native/bin/v120\Win32\Debug\grpc_csharp_ext.dll" /> + </files> +</package> \ No newline at end of file diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.props b/vsprojects/nuget_package/grpc.native.csharp_ext.props new file mode 100644 index 0000000000000000000000000000000000000000..63d23be3dad317e22e539d26e4e07be5f1821775 --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.props @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <!-- Whether or not copy native dependencies to output directory after building --> + <CopyNativeDependencies Condition=" '$(CopyNativeDependencies)' == '' ">true</CopyNativeDependencies> + + <!-- Set defaults for native dependencies if not already set. Properties can be overriden in the project files. --> + <NativeDependenciesToolset Condition=" '$(NativeDependenciesToolset)' == '' ">v120</NativeDependenciesToolset> + <NativeDependenciesPlatform Condition=" '$(NativeDependenciesPlatform)' == '' ">Win32</NativeDependenciesPlatform> + <NativeDependenciesConfiguration Condition=" '$(NativeDependenciesConfiguration)' == '' ">Debug</NativeDependenciesConfiguration> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/vsprojects/nuget_package/grpc.native.csharp_ext.targets b/vsprojects/nuget_package/grpc.native.csharp_ext.targets new file mode 100644 index 0000000000000000000000000000000000000000..1b69362d432a08092539bdc8fee7e2514fbd245f --- /dev/null +++ b/vsprojects/nuget_package/grpc.native.csharp_ext.targets @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Choose> + <!-- Under older versions of Monodevelop, Choose is not supported and is just ignored, which gives us the desired effect. --> + <When Condition=" '$(OS)' != 'Unix' "> + <ItemGroup Condition=" '$(CopyNativeDependencies)' == 'true' "> + <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